[Piglit] [PATCH] Add option '-r' to allow resume test after first test match filter
Shuang He
shuang.he at intel.com
Mon Aug 29 17:41:23 PDT 2011
On 2011/8/27 22:57, He, Shuang wrote:
> This is useful when we want to resume test after tests are blocked by one case
> ---
> 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()
If there's no objection, I'm going to commit it tomorrow
Thanks
--Shuang
More information about the Piglit
mailing list