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

Adrian Reber adrian at lisas.de
Thu Oct 27 23:55:51 PDT 2016


On Thu, Oct 27, 2016 at 11:52:53PM +0300, Pavel Emelyanov wrote:
> On 10/27/2016 07:05 PM, Adrian Reber wrote:
> > 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:
> 
> Do you know why they fail?

Many of the tests fail with:

======================== Run zdtm/static/futex-rl in h =========================
Start test
./futex-rl --pidfile=futex-rl.pid --outfile=futex-rl.out
Run criu dump
Only checking if requested operation will succeed
Wait for zdtm/static/futex-rl(30) to die for 0.100000
Run criu restore
Checking mode enabled
=[log]=> dump/zdtm/static/futex-rl/30/1/restore.log
------------------------ grep Error ------------------------
(00.006095)     30: Error (criu/shmem.c:551): Can't restore shmem content
(00.006101)     30: Error (criu/mem.c:970): `- Can't open vma
(00.006147) Error (criu/cr-restore.c:2000): Restoring FAILED.
------------------------ ERROR OVER ------------------------
################ Test zdtm/static/futex-rl FAIL at CRIU restore ################

It seems, without looking at the code yet, that --check-only does not
dump the shared memory but tries to restore it. Which fails as it has
not been dumped. I will fix this in the check-only mode in an upcoming
patch.

		Adrian

> >  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)


More information about the CRIU mailing list