Commit f01ae34e authored by Pavel Emelyanov's avatar Pavel Emelyanov

zdtm.py: Make zdtm/ and zdtm_ct before run

The zdtm.py depends on this stuff.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent abdea652
...@@ -343,6 +343,13 @@ class zdtm_test: ...@@ -343,6 +343,13 @@ class zdtm_test:
def blocking(self): def blocking(self):
return test_flag(self.__desc, 'crfail') 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: class inhfd_test:
...@@ -429,6 +436,10 @@ class inhfd_test: ...@@ -429,6 +436,10 @@ class inhfd_test:
def blocking(self): def blocking(self):
return False return False
@staticmethod
def available():
pass
test_classes = { 'zdtm': zdtm_test, 'inhfd': inhfd_test } test_classes = { 'zdtm': zdtm_test, 'inhfd': inhfd_test }
...@@ -436,6 +447,7 @@ 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 when launched using CLI
# #
criu_bin = "../criu"
class criu_cli: class criu_cli:
def __init__(self, opts): def __init__(self, opts):
self.__test = None self.__test = None
...@@ -468,7 +480,7 @@ class criu_cli: ...@@ -468,7 +480,7 @@ class criu_cli:
if fault: if fault:
print "Forcing %s fault" % fault print "Forcing %s fault" % fault
env = dict(os.environ, CRIU_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() return cr.wait()
def __criu_act(self, action, opts, log = None): def __criu_act(self, action, opts, log = None):
...@@ -522,6 +534,12 @@ class criu_cli: ...@@ -522,6 +534,12 @@ class criu_cli:
def check(feature): def check(feature):
return criu_cli.__criu("check", ["-v0", "--feature", feature]) == 0 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): def try_run_hook(test, args):
hname = test.getname() + '.hook' hname = test.getname() + '.hook'
...@@ -867,4 +885,8 @@ opts = vars(p.parse_args()) ...@@ -867,4 +885,8 @@ opts = vars(p.parse_args())
if opts['debug']: if opts['debug']:
sys.settrace(traceit) sys.settrace(traceit)
criu_cli.available()
for tst in test_classes.values():
tst.available()
opts['action'](opts) opts['action'](opts)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment