[CRIU] [PATCH 4/4] zdtm.py: don't fail tests if pids collide

Tycho Andersen tycho.andersen at canonical.com
Tue Nov 3 13:20:36 PST 2015


It seems with the new zdtm.py that pids collide a lot more (perhaps because
everything is in its own pid namespace? not sure). In any case, this is
annoying as it prevents a second run of the tests from actually getting to
the test part.

So, let's try to move the old directory out of the way.

Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
---
 test/zdtm.py | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/test/zdtm.py b/test/zdtm.py
index d89a122..feac963 100755
--- a/test/zdtm.py
+++ b/test/zdtm.py
@@ -468,6 +468,15 @@ class criu_cli:
 	def set_test(self, test):
 		self.__test = test
 		self.__dump_path = "dump/" + test.getname() + "/" + test.getpid()
+		if os.path.exists(self.__dump_path):
+			for i in xrange(100):
+				newpath = self.__dump_path + "." + str(i)
+				if not os.path.exists(newpath):
+					os.rename(self.__dump_path, newpath)
+					break
+			else:
+				raise test_fail_exc("couldn't find dump dir %s" % self.__dump_path)
+
 		os.makedirs(self.__dump_path)
 
 	def cleanup(self):
-- 
2.5.0



More information about the CRIU mailing list