[Piglit] [PATCH] Add option '-r' to allow resume test after first test match filter

Ian Romanick idr at freedesktop.org
Mon Aug 29 20:47:48 PDT 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 08/27/2011 07:57 AM, Shuang He wrote:
> This is useful when we want to resume test after tests are blocked by one case

I don't think this is the mechanism that we really want.  It's certainly
not the mechanism that *I* want.  What would be better is to have it
automatically figure out where to resume and continue appending to the
existing results file.

In order to do this, I think it would have to emit some sort of "test
started" entry to the log.  The resume would just skip any tests that
already have a "started" entry in the log.  pigit-summary-html.py would
also need to generate a new result type for tests that started but
didn't finish.

I know Chad and Paul had some ideas about this, so you should talk with
them before going further.

> ---
>  framework/core.py |    7 +++++++
>  piglit-run.py     |    6 +++++-
>  2 files changed, 12 insertions(+), 1 deletions(-)
> 
> diff --git a/framework/core.py b/framework/core.py
> index 90aa461..ab324d2 100644
> --- a/framework/core.py
> +++ b/framework/core.py
> @@ -390,6 +390,7 @@ class Environment:
>  		self.execute = True
>  		self.filter = []
>  		self.exclude_filter = []
> +		self.resume_filter = []
>  
>  	def run(self, command):
>  		try:
> @@ -443,6 +444,12 @@ class Test:
>  			self.__doRunWork(*args)
>  
>  	def __doRunWork(self, env, path, json_writer):
> +		# Resume tests after first matching test
> +		if len(env.resume_filter) > 0:
> +			if True in map(lambda f: f.search(path) != None, env.resume_filter):
> +				env.resume_filter = []
> +			return None
> +
>  		# Exclude tests that don't match the filter regexp
>  		if len(env.filter) > 0:
>  			if not True in map(lambda f: f.search(path) != None, env.filter):
> diff --git a/piglit-run.py b/piglit-run.py
> index c5f5a4a..0d74348 100755
> --- a/piglit-run.py
> +++ b/piglit-run.py
> @@ -49,6 +49,7 @@ Options:
>    -n name, --name=name      Name of the testrun
>    -c bool, --concurrent=bool  Enable/disable concurrent test runs. Valid
>  			      option values are: 0, 1, on, off.  (default: on)
> +  -r regexp, --resume-after=regexp  Resume tests after first matching test
>  Example:
>    %(progName)s tests/all.tests results/all
>           Run all tests, store the results in the directory results/all
> @@ -74,8 +75,9 @@ def main():
>  			 "name=",
>  			 "exclude-tests=",
>  			 "concurrent=",
> +			 "resume-after=",
>  			 ]
> -		options, args = getopt(sys.argv[1:], "hdt:n:x:c:", option_list)
> +		options, args = getopt(sys.argv[1:], "hdt:n:x:c:r:", option_list)
>  	except GetoptError:
>  		usage()
>  
> @@ -99,6 +101,8 @@ def main():
>  				env.concurrent = False
>  			else:
>  				usage()
> +		elif name in ('-r, --resume-after'):
> +			env.resume_filter[:0] = [re.compile(value)]
>  
>  	if len(args) != 2:
>  		usage()

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAk5cXWQACgkQX1gOwKyEAw9BuQCeNrTiqCCRf1sL2BNBq4FmNl4a
WlMAn1dZMc1VU1t5L4Xbg4Z7cb2zI9De
=RqJ4
-----END PGP SIGNATURE-----


More information about the Piglit mailing list