From f01ae34ecee5012e1f9e62326d27e3a27bd828fa Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Thu, 29 Oct 2015 14:15:00 +0300 Subject: [PATCH] zdtm.py: Make zdtm/ and zdtm_ct before run The zdtm.py depends on this stuff. Signed-off-by: Pavel Emelyanov --- test/zdtm.py | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/test/zdtm.py b/test/zdtm.py index 960fb8373..0a181f3d7 100755 --- a/test/zdtm.py +++ b/test/zdtm.py @@ -343,6 +343,13 @@ class zdtm_test: def blocking(self): return test_flag(self.__desc, 'crfail') + @staticmethod + def available(): + if not os.access("zdtm_ct", os.X_OK): + subprocess.check_call(["make", "zdtm_ct"]) + if not os.access("zdtm/lib/libzdtmtst.a", os.F_OK): + subprocess.check_call(["make", "-C", "zdtm/"]) + class inhfd_test: @@ -429,6 +436,10 @@ class inhfd_test: def blocking(self): return False + @staticmethod + def available(): + pass + test_classes = { 'zdtm': zdtm_test, 'inhfd': inhfd_test } @@ -436,6 +447,7 @@ test_classes = { 'zdtm': zdtm_test, 'inhfd': inhfd_test } # CRIU when launched using CLI # +criu_bin = "../criu" class criu_cli: def __init__(self, opts): self.__test = None @@ -468,7 +480,7 @@ class criu_cli: if fault: print "Forcing %s fault" % fault env = dict(os.environ, CRIU_FAULT = fault) - cr = subprocess.Popen(["../criu", action] + args, env = env) + cr = subprocess.Popen([criu_bin, action] + args, env = env) return cr.wait() def __criu_act(self, action, opts, log = None): @@ -522,6 +534,12 @@ class criu_cli: def check(feature): return criu_cli.__criu("check", ["-v0", "--feature", feature]) == 0 + @staticmethod + def available(): + if not os.access(criu_bin, os.X_OK): + print "CRIU binary not built" + sys.exit(1) + def try_run_hook(test, args): hname = test.getname() + '.hook' @@ -867,4 +885,8 @@ opts = vars(p.parse_args()) if opts['debug']: sys.settrace(traceit) +criu_cli.available() +for tst in test_classes.values(): + tst.available() + opts['action'](opts)