[CRIU] [PATCH 1/2] zdtm.py: add option --ignore-fails

Sergey Bronnikov sergeyb at openvz.org
Sat Mar 5 02:39:57 PST 2016


On 14:49 Fri 04 Mar , Andrew Vagin wrote:
> On Thu, Mar 03, 2016 at 06:13:15PM +0300, Sergey Bronnikov wrote:
> > Introduce an option --ignore-fails to make ability to run all planned tests and
> > ignore failed tests.
> >
> 
> Here is a very similar functionality:
> [RFC PATCH 02/21] zdtm: zdtm.py: add --keep-going and --log-failures options 
> 
> Will a report contains images and logs for each failed test?

My patch is quite simple and cares only about logic of test running - zdtm.py
shouldn't raise exception in case of test fail when option --ignore-fails
specified. AFAIK zdtm.py will keep output from failed tests in case of option
'--report'.

> > Signed-off-by: Sergey Bronnikov <sergeyb at openvz.org>
> > ---
> >  test/zdtm.py | 13 +++++++++----
> >  1 file changed, 9 insertions(+), 4 deletions(-)
> > 
> > diff --git a/test/zdtm.py b/test/zdtm.py
> > index 1ace919..75e4514 100755
> > --- a/test/zdtm.py
> > +++ b/test/zdtm.py
> > @@ -947,8 +947,9 @@ def do_run_test(tname, tdesc, flavs, opts):
> >  			add_to_report(cr_api.logs(), "cr_logs")
> >  			if opts['keep_img'] == 'never':
> >  				cr_api.cleanup()
> > -			# This exit does two things -- exits from subprocess and
> > -			# aborts the main script execution on the 1st error met
> > +			# When option --ignore-fails not specified this exit
> > +			# does two things: exits from subprocess and aborts the
> > +			# main script execution on the 1st error met
> >  			sys.exit(1)
> >  		else:
> >  			if opts['keep_img'] != 'always':
> > @@ -1035,12 +1036,12 @@ class launcher:
> >  		while self.__subs:
> >  			if not self.__wait_one(os.WNOHANG):
> >  				break
> > -		if self.__fail:
> > +		if (not opts['ignore_fails'] and self.__fail):
> >  			raise test_fail_exc('')
> >  
> >  	def wait_all(self):
> >  		self.__wait_all()
> > -		if self.__fail:
> > +		if (not opts['ignore_fails'] and self.__fail):
> >  			raise test_fail_exc('')
> >  
> >  	def finish(self):
> > @@ -1128,6 +1129,9 @@ def run_tests(opts):
> >  	if opts['report']:
> >  		init_report(opts['report'])
> >  
> > +	if opts['ignore_fails']:
> > +		print "Ignore fails and run all planned tests."
> > +
> >  	if opts['parallel'] and opts['freezecg']:
> >  		print "Parallel launch with freezer not supported"
> >  		opts['parallel'] = None
> > @@ -1346,6 +1350,7 @@ if os.environ.has_key('CR_CT_TEST_INFO'):
> >  p = argparse.ArgumentParser("CRIU test suite")
> >  p.add_argument("--debug", help = "Print what's being executed", action = 'store_true')
> >  p.add_argument("--set", help = "Which set of tests to use", default = 'zdtm')
> > +p.add_argument("--ignore-fails", help = "Ignore fails and run all planned tests", action = 'store_true')
> >  
> >  sp = p.add_subparsers(help = "Use --help for list of actions")
> >  
> > -- 
> > 2.5.0
> > 
> > 
> > -- 
> > sergeyb@
> > _______________________________________________
> > CRIU mailing list
> > CRIU at openvz.org
> > https://lists.openvz.org/mailman/listinfo/criu

-- 
sergeyb@


More information about the CRIU mailing list