[CRIU] [PATCH] zdtm: added option to run tests in check-only mode

Adrian Reber adrian at lisas.de
Thu Oct 27 09:05:47 PDT 2016


From: Adrian Reber <areber at redhat.com>

This adds an additional option to zdtm.py: --check-only
Using this option '--check-only' is added to the 'criu dump'
command-line. During restore criu auto-detects that the
checkpoint was a 'check-only' checkpoint.

Running zdtm.py with '--check-only' reveals that the check-only
code path is not implemented everywhere as some tests are starting
to fail when using '--check-only' with zdtm.

Some tests cannot work as the process is not really restored and if
the process should create or delete something this will not happen.
These tests need to be excluded from zdtm in check-only mode.

Most of the other failures are related to restoring shmem which fails
in check-only mode. This needs to be fixed in the check-only mode
code paths in criu. Patch will follow.

Following tests are currently failing in check-only mode:

 zdtm/static/futex-rl
 zdtm/static/pthread00
 zdtm/static/pthread01
 zdtm/static/socket-tcpbuf
 zdtm/static/maps01
 zdtm/static/file_fown
 zdtm/static/aio00
 zdtm/static/aio01
 zdtm/static/fd
 zdtm/static/maps00
 zdtm/static/unlink_fstat03
 zdtm/static/fanotify-del-after-cr
 zdtm/transition/fork2
 zdtm/transition/maps007
 zdtm/transition/maps008
 zdtm/transition/shmem
 zdtm/transition/file_read
 zdtm/transition/fifo_loop

Signed-off-by: Adrian Reber <areber at redhat.com>
---
 test/zdtm.py | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/test/zdtm.py b/test/zdtm.py
index e032716..9cba7cb 100755
--- a/test/zdtm.py
+++ b/test/zdtm.py
@@ -769,6 +769,7 @@ class criu:
 		self.__user = (opts['user'] and True or False)
 		self.__leave_stopped = (opts['stop'] and True or False)
 		self.__criu = (opts['rpc'] and criu_rpc or criu_cli)
+		self.__check_only = (opts['check_only'] and True or False)
 
 	def logs(self):
 		return self.__dump_path
@@ -891,10 +892,16 @@ class criu:
 		if self.__leave_stopped:
 			a_opts += ['--leave-stopped']
 
+		if self.__check_only:
+			a_opts += ['--check-only']
+
 		self.__criu_act(action, opts = a_opts + opts)
 		if self.__mdedup and self.__iter > 1:
 			self.__criu_act("dedup", opts = [])
 
+		if self.__check_only:
+			pstree_signal(self.__test.getpid(), signal.SIGKILL)
+
 		if self.__leave_stopped:
 			pstree_check_stopped(self.__test.getpid())
 			pstree_signal(self.__test.getpid(), signal.SIGKILL)
@@ -1274,7 +1281,8 @@ def do_run_test(tname, tdesc, flavs, opts):
 				check_visible_state(t, s, opts)
 				if opts['join_ns']:
 					check_joinns_state(t)
-				t.stop()
+				if not opts['check_only']:
+					t.stop()
 				try_run_hook(t, ["--clean"])
 		except test_fail_exc as e:
 			print_sep("Test %s FAIL at %s" % (tname, e.step), '#')
@@ -1351,6 +1359,7 @@ class launcher:
 
 		nd = ('nocr', 'norst', 'pre', 'iters', 'page_server', 'sibling', 'stop', 'lazy_pages',
 				'fault', 'keep_img', 'report', 'snaps', 'sat', 'script', 'rpc',
+				'check_only',
 				'join_ns', 'dedup', 'sbs', 'freezecg', 'user', 'dry_run', 'noauto_dedup')
 		arg = repr((name, desc, flavor, {d: self.__opts[d] for d in nd}))
 
@@ -1810,6 +1819,7 @@ rp.add_argument("-k", "--keep-img", help = "Whether or not to keep images after
 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("--check-only", help = "Run criu in check-only mode (memory pages are not dumped)", action = 'store_true')
 
 lp = sp.add_parser("list", help = "List tests")
 lp.set_defaults(action = list_tests)
-- 
2.9.3



More information about the CRIU mailing list