[CRIU] [RESEND v2 5/5] zdtm: also dump and restore tests with --check-only
Adrian Reber
adrian at lisas.de
Tue May 23 02:42:15 PDT 2017
From: Adrian Reber <areber at redhat.com>
This adds the option '--check-only' to zdtm.py. If specified each test
cases is first dumped with the '--check-only' option enabled before the
real dump. Also during restore the test case is first restored with
--check-only before doing the real restore.
Signed-off-by: Adrian Reber <areber at redhat.com>
---
test/zdtm.py | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/test/zdtm.py b/test/zdtm.py
index b5062ea..f983ee7 100755
--- a/test/zdtm.py
+++ b/test/zdtm.py
@@ -804,6 +804,7 @@ class criu:
self.__leave_stopped = (opts['stop'] and True or False)
self.__remote = (opts['remote'] and True or False)
self.__criu = (opts['rpc'] and criu_rpc or criu_cli)
+ self.__check_only = (opts['check_only'] and True or False)
self.__lazy_pages_p = None
self.__page_server_p = None
@@ -848,7 +849,10 @@ class criu:
with open(os.path.join(self.__ddir(), action + '.cropt'), 'w') as f:
f.write(' '.join(s_args) + '\n')
- print "Run criu " + action
+ if '--check-only' in opts:
+ print "Run criu " + action + " in check-only mode"
+ else:
+ print "Run criu " + action
strace = []
if self.__sat:
@@ -886,6 +890,13 @@ class criu:
os.close(status_fds[0])
return ret
+ if '--check-only' in opts and action == "restore":
+ # Although the restored process never starts
+ # running in check-only mode, it sometimes takes
+ # some time for the process to disappear.
+ # Wait until it is gone.
+ self.__test.gone()
+
grep_errors(os.path.join(__ddir, log))
if ret != 0:
if self.__fault and int(self.__fault) < 128:
@@ -970,6 +981,9 @@ class criu:
if self.__empty_ns:
a_opts += ['--empty-ns', 'net']
+ if self.__check_only:
+ self.__criu_act(action, opts = a_opts + opts + ['--check-only'])
+
self.__criu_act(action, opts = a_opts + opts)
if self.__mdedup and self.__iter > 1:
self.__criu_act("dedup", opts = [])
@@ -1019,6 +1033,11 @@ class criu:
if self.__leave_stopped:
r_opts += ['--leave-stopped']
+ if self.__check_only:
+ self.__criu_act("restore", opts = r_opts + ["--restore-detached"] + ['--check-only'])
+ # sometimes the real restore fails with PID conflicts without this
+ reset_pid()
+
self.__criu_act("restore", opts = r_opts + ["--restore-detached"])
if self.__lazy_pages_p:
@@ -1475,7 +1494,7 @@ class launcher:
nd = ('nocr', 'norst', 'pre', 'iters', 'page_server', 'sibling', 'stop', 'empty_ns',
'fault', 'keep_img', 'report', 'snaps', 'sat', 'script', 'rpc', 'lazy_pages',
'join_ns', 'dedup', 'sbs', 'freezecg', 'user', 'dry_run', 'noauto_dedup',
- 'remote_lazy_pages', 'remote')
+ 'remote_lazy_pages', 'remote', 'check_only')
arg = repr((name, desc, flavor, {d: self.__opts[d] for d in nd}))
if self.__use_log:
@@ -1989,6 +2008,7 @@ rp.add_argument("--report", help = "Generate summary report in directory")
rp.add_argument("--keep-going", help = "Keep running tests in spite of failures", action = 'store_true')
rp.add_argument("--lazy-pages", help = "restore pages on demand", action = 'store_true')
rp.add_argument("--remote-lazy-pages", help = "simulate lazy migration", action = 'store_true')
+rp.add_argument("--check-only", help = "Additionally try to dump/restore in --check-only mode", action = 'store_true')
lp = sp.add_parser("list", help = "List tests")
lp.set_defaults(action = list_tests)
--
1.8.3.1
More information about the CRIU
mailing list