[CRIU] [RFC PATCHv2 06/32] zdtm: zdtm.py: write "meta" checkskip/hook scripts for group tests
Ivan Shapovalov
intelfx at intelfx.name
Sat Mar 12 00:42:05 PST 2016
Signed-off-by: Ivan Shapovalov <intelfx at intelfx.name>
---
test/zdtm.py | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/test/zdtm.py b/test/zdtm.py
index d3e3923..79ffcd1 100755
--- a/test/zdtm.py
+++ b/test/zdtm.py
@@ -1304,6 +1304,24 @@ class group:
def size(self):
return len(self.__tests)
+ # common method to write a "meta" auxiliary script (hook/checkskip)
+ # which will call all tests' scripts in turn
+ def dump_meta(self, fname, ext):
+ scripts = filter(lambda names: os.access(names[1], os.X_OK),
+ map(lambda test: (test, test + ext),
+ self.__tests))
+ if scripts:
+ f = open(fname + ext, "w")
+ f.write("#!/bin/sh -e\n")
+
+ for test, script in scripts:
+ f.write("echo 'Running %s for %s'\n" % (ext, test))
+ f.write('%s "$@"\n' % script)
+
+ f.write("echo 'All %s scripts OK'\n" % ext)
+ f.close()
+ os.chmod(fname + ext, 0700)
+
def dump(self, fname):
f = open(fname, "w")
for t in self.__tests:
@@ -1318,6 +1336,9 @@ class group:
f.write(repr(self.__desc))
f.close()
+ # write "meta" .checkskip and .hook scripts
+ self.dump_meta(fname, '.checkskip')
+ self.dump_meta(fname, '.hook')
def group_tests(opts):
excl = None
--
2.7.2
More information about the CRIU
mailing list