Commit d6bdc90a authored by Dengguangxing's avatar Dengguangxing Committed by Pavel Emelyanov

join-ns: add join-ns zdtm test

Signed-off-by: 's avatarDeng Guangxing <dengguangxing@huawei.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 790ec469
......@@ -617,6 +617,7 @@ test_classes = { 'zdtm': zdtm_test, 'inhfd': inhfd_test, 'groups': groups_test }
#
criu_bin = "../criu/criu"
join_ns_file = '/run/netns/zdtm_netns'
class criu_cli:
def __init__(self, opts):
self.__test = None
......@@ -625,6 +626,7 @@ class criu_cli:
self.__prev_dump_iter = None
self.__page_server = (opts['page_server'] and True or False)
self.__restore_sibling = (opts['sibling'] and True or False)
self.__join_ns = (opts['join_ns'] and True or False)
self.__fault = (opts['fault'])
self.__script = opts['script']
self.__sat = (opts['sat'] and True or False)
......@@ -763,6 +765,9 @@ class criu_cli:
r_opts = ["--restore-sibling"]
self.__test.auto_reap = False
r_opts += self.__test.getropts()
if self.__join_ns:
r_opts.append("--join-ns")
r_opts.append("net:%s" % join_ns_file)
self.__prev_dump_iter = None
criu_dir = os.path.dirname(os.getcwd())
......@@ -1087,7 +1092,7 @@ class launcher:
nd = ('nocr', 'norst', 'pre', 'iters', 'page_server', 'sibling', \
'fault', 'keep_img', 'report', 'snaps', 'sat', 'script', \
'dedup', 'sbs', 'freezecg', 'user', 'dry_run')
'join_ns', 'dedup', 'sbs', 'freezecg', 'user', 'dry_run')
arg = repr((name, desc, flavor, { d: self.__opts[d] for d in nd }))
if self.__use_log:
......@@ -1259,6 +1264,14 @@ def run_tests(opts):
print "Parallel launch with freezer not supported"
opts['parallel'] = None
if opts['join_ns']:
print "[WARNING] Option --join-ns will skip ns and uns flavors, and some socket related tests."
r = re.compile('^(?!.*sock).*$')
torun = filter(lambda x: r.match(x), torun)
opts['keep_going'] = True
run_all = True
subprocess.Popen(["ip", "netns", "add", "zdtm_netns"])
l = launcher(opts, len(torun))
try:
for t in torun:
......@@ -1311,13 +1324,18 @@ def run_tests(opts):
# FIXME -- probably uns will make sense
run_flavs -= set(['ns', 'uns'])
#remove ns and uns flavor in join_ns
if opts['join_ns']:
run_flavs -= set(['ns', 'uns'])
if run_flavs:
l.run_test(t, tdesc, run_flavs)
else:
l.skip(t, "no flavors")
finally:
l.finish()
if opts['join_ns']:
subprocess.Popen(["ip", "netns", "delete", "zdtm_netns"])
sti_fmt = "%-40s%-10s%s"
......@@ -1497,6 +1515,7 @@ rp.add_argument("-f", "--flavor", help = "Flavor to run")
rp.add_argument("-x", "--exclude", help = "Exclude tests from --all run", action = 'append')
rp.add_argument("--sibling", help = "Restore tests as siblings", action = 'store_true')
rp.add_argument("--join-ns", help = "Restore tests and join existing namespace", action = 'store_true')
rp.add_argument("--pre", help = "Do some pre-dumps before dump (n[:pause])")
rp.add_argument("--snaps", help = "Instead of pre-dumps do full dumps", action = 'store_true')
rp.add_argument("--dedup", help = "Auto-deduplicate images on iterations", action = 'store_true')
......
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