[CRIU] [PATCH] zdtm.py: Make zdtm/ and zdtm_ct before run
Pavel Emelyanov
xemul at parallels.com
Thu Oct 29 04:15:49 PDT 2015
The zdtm.py depends on this stuff.
Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
---
diff --git a/test/zdtm.py b/test/zdtm.py
index 0d0d473..2e17040 100755
--- a/test/zdtm.py
+++ b/test/zdtm.py
@@ -316,6 +316,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:
@@ -402,6 +409,10 @@ class inhfd_test:
def blocking(self):
return False
+ @staticmethod
+ def available():
+ pass
+
test_classes = { 'zdtm': zdtm_test, 'inhfd': inhfd_test }
@@ -409,6 +420,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
@@ -438,7 +450,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):
@@ -492,6 +504,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'
@@ -832,4 +850,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)
More information about the CRIU
mailing list