2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-09-01 06:45:35 +00:00

zdtm.py: Make zdtm/ and zdtm_ct before run

The zdtm.py depends on this stuff.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Pavel Emelyanov
2015-10-29 14:15:00 +03:00
parent abdea652a9
commit f01ae34ece

View File

@@ -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:
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 }
# 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:
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:
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())
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)