[CRIU] [PATCH 1/2] tests: remember to clean everything on make clean

Tycho Andersen tycho.andersen at canonical.com
Tue Feb 16 08:18:16 PST 2016


If we forget to clean some of this stuff, we can get into strange states
where zdtm.py thinks it has constructed the root, but really hasn't, and
can't construct the root because it partially exists.

Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
---
 test/Makefile | 4 ++++
 test/zdtm.py  | 6 ++++++
 2 files changed, 10 insertions(+)

diff --git a/test/Makefile b/test/Makefile
index 059ae38..a0a22b0 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -52,6 +52,10 @@ clean_root:
 	$(Q) $(RM) -r ./etc
 	$(Q) $(RM) -r ./dev
 	$(Q) $(RM) -r ./bin
+	$(Q) $(RM) -r ./sbin
+	$(Q) $(RM) -r ./proc
+	$(Q) $(RM) -r ./usr
+	$(Q) $(RM) -r ./.constructed
 
 clean: clean_root
 	$(RM) zdtm_ct zdtm-tst-list
diff --git a/test/zdtm.py b/test/zdtm.py
index 01b20e7..4bde1ec 100755
--- a/test/zdtm.py
+++ b/test/zdtm.py
@@ -161,6 +161,7 @@ class ns_flavor:
 
 	def __construct_root(self):
 		for dir in self.__root_dirs:
+			print "mkdiring ", self.root + dir
 			os.mkdir(self.root + dir)
 			os.chmod(self.root + dir, 0777)
 
@@ -181,14 +182,17 @@ class ns_flavor:
 		raise test_fail_exc("Deps check %s failed" % deps)
 
 	def init(self, l_bins, x_bins):
+		print "init called for %s", l_bins[0]
 		subprocess.check_call(["mount", "--make-slave", "--bind", ".", self.root])
 		self.root_mounted = True
+		print "root mounted for %s", l_bins[0]
 
 		if not os.access(self.root + "/.constructed", os.F_OK):
 			with open(os.path.abspath(__file__)) as o:
 				fcntl.flock(o, fcntl.LOCK_EX)
 				if not os.access(self.root + "/.constructed", os.F_OK):
 					print "Construct root for %s" % l_bins[0]
+					print "root is ", self.root
 					self.__construct_root()
 					os.mknod(self.root + "/.constructed", stat.S_IFREG | 0600)
 
@@ -211,7 +215,9 @@ class ns_flavor:
 			if os.access(p, os.F_OK):
 				shutil.rmtree('./' + d)
 
+		print "accessing constructed...", os.access('./.constructed', os.F_OK)
 		if os.access('./.constructed', os.F_OK):
+			print "unlinking constructed"
 			os.unlink('./.constructed')
 
 
-- 
2.6.4



More information about the CRIU mailing list