[CRIU] [PATCH] zdtm.py: Do not run tests marked with excl in parallel (v2)
Pavel Emelyanov
xemul at parallels.com
Thu Nov 12 09:58:34 PST 2015
There are tests (e.g. on locks) that can conflict with each other, so
wait for all the other jobs to finish before running such.
v2:
Wait for the excl test to finish before launching more of them.
Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
---
test/zdtm.py | 23 +++++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)
diff --git a/test/zdtm.py b/test/zdtm.py
index 10971c3..fecbbdd 100755
--- a/test/zdtm.py
+++ b/test/zdtm.py
@@ -704,10 +704,12 @@ class launcher:
print "=== Run %d/%d %s" % (self.__nr, self.__total, '=' * perc + '-' * (16 - perc))
def run_test(self, name, desc, flavor):
+
if len(self.__subs) >= self.__max:
self.wait()
- if self.__fail:
- raise test_fail_exc('')
+
+ if test_flag(desc, 'excl'):
+ self.wait_all()
self.__nr += 1
self.__show_progress()
@@ -720,6 +722,9 @@ class launcher:
stdout = open(log, "w"), stderr = subprocess.STDOUT)
self.__subs[sub.pid] = { 'sub': sub, 'log': log }
+ if test_flag(desc, 'excl'):
+ self.wait()
+
def __wait_one(self, flags):
pid, status = os.waitpid(0, flags)
if pid != 0:
@@ -734,15 +739,25 @@ class launcher:
return False
+ def __wait_all(self):
+ while self.__subs:
+ self.__wait_one(0)
+
def wait(self):
self.__wait_one(0)
while self.__subs:
if not self.__wait_one(os.WNOHANG):
break
+ if self.__fail:
+ raise test_fail_exc('')
+
+ def wait_all(self):
+ self.__wait_all()
+ if self.__fail:
+ raise test_fail_exc('')
def finish(self):
- while self.__subs:
- self.__wait_one(0)
+ self.__wait_all()
if self.__fail:
print_sep("FAIL", "#")
sys.exit(1)
--
1.9.3
More information about the CRIU
mailing list