[CRIU] [RFC PATCHv2 04/32] zdtm: zdtm.py: implement exhaustive group generation (still subject to test compatibility screening)

Ivan Shapovalov intelfx at intelfx.name
Mon Mar 14 08:25:24 PDT 2016


On 2016-03-14 at 14:26 +0300, Pavel Emelyanov wrote:
> On 03/12/2016 11:42 AM, Ivan Shapovalov wrote:
> > 
> > Signed-off-by: Ivan Shapovalov <intelfx at intelfx.name>
> > ---
> >  test/zdtm.py | 42 ++++++++++++++++++++++++++++--------------
> >  1 file changed, 28 insertions(+), 14 deletions(-)
> > 
> > diff --git a/test/zdtm.py b/test/zdtm.py
> > index d84e1cc..c3f900a 100755
> > --- a/test/zdtm.py
> > +++ b/test/zdtm.py
> > @@ -18,6 +18,7 @@ import imp
> >  import socket
> >  import fcntl
> >  import errno
> > +import itertools
> >  
> >  os.chdir(os.path.dirname(os.path.abspath(__file__)))
> >  
> > @@ -1331,25 +1332,37 @@ def group_tests(opts):
> >  	random.shuffle(tlist)
> Since you're generating all possible combinations you don't need this
> shuffle.

Missed this, thanks. Made conditional.

--
Ivan Shapovalov / intelfx /

> 
> > 
> >  	if opts['exclude']:
> >  		excl = re.compile(".*(" +
> > "|".join(opts['exclude']) + ")")
> > +		tlist = filter(lambda t: not excl.match(t), tlist)
> >  		print "Compiled exclusion list"
> >  
> > -	for t in tlist:
> > -		if excl and excl.match(t):
> > -			continue
> > +	tdlist = itertools.imap(get_test_desc, tlist)
> >  
> > -		td = get_test_desc(t)
> > -
> > -		for g in pend_groups:
> > -			if g.merge(t, td):
> > -				if g.size() == maxs:
> > -					pend_groups.remove(g)
> > -					groups.append(g)
> > -				break
> > -		else:
> > +	if opts['exhaustive']:
> > +		for tgroup in itertools.combinations(zip(tlist,
> > tdlist), maxs):
> > +			t, td = tgroup[0]
> >  			g = group(t, td)
> > -			pend_groups.append(g)
> > +			for t, td in tgroup[1:]:
> > +				# because we are enumerating all
> > combinations,
> > +				# we skip the whole combination on
> > incompatibility
> > +				# (i. e. we do not allow short
> > groups).
> > +				if not g.merge(t, td):
> > +					break
> > +			else:
> > +				groups.append(g)
> >  
> > -	groups += pend_groups
> > +	else:
> > +		for t, td in zip(tlist, tdlist):
> > +			for g in pend_groups:
> > +				if g.merge(t, td):
> > +					if g.size() == maxs:
> > +						pend_groups.remove
> > (g)
> > +						groups.append(g)
> > +					break
> > +			else:
> > +				g = group(t, td)
> > +				pend_groups.append(g)
> > +
> > +		groups += pend_groups
> >  
> >  	nr = 0
> >  	suf = opts['name'] or 'group'
> > @@ -1442,6 +1455,7 @@ gp.set_defaults(action = group_tests)
> >  gp.add_argument("-m", "--max-size", help = "Maximum number of
> > tests in group")
> >  gp.add_argument("-n", "--name", help = "Common name for group
> > tests")
> >  gp.add_argument("-x", "--exclude", help = "Exclude tests from --
> > all run", action = 'append')
> > +gp.add_argument("--exhaustive", help = "Generate groups for all
> > possible combinations of tests", action = 'store_true')
> >  
> >  cp = sp.add_parser("clean", help = "Clean something")
> >  cp.set_defaults(action = clean_stuff)
> > 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.openvz.org/pipermail/criu/attachments/20160314/9192dc1f/attachment.sig>


More information about the CRIU mailing list