[Piglit] [PATCH v3 14/28] framework: Remove exclude_tests from options.OPTIONS
Dylan Baker
dylan at pnwbakers.com
Mon Oct 31 17:50:10 UTC 2016
Rather than putting this in a global variable, just add a filter for
this in the runner. Far simpler, and removes more globals.
Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
framework/options.py | 1 -
framework/profile.py | 1 -
framework/programs/run.py | 5 ++++-
unittests/framework/test_profile.py | 17 -----------------
4 files changed, 4 insertions(+), 20 deletions(-)
diff --git a/framework/options.py b/framework/options.py
index 46e37ee..dc97c38 100644
--- a/framework/options.py
+++ b/framework/options.py
@@ -189,7 +189,6 @@ class _Options(object): # pylint: disable=too-many-instance-attributes
self.execute = True
self._include_filter = _ReList()
self._exclude_filter = _ReList()
- self.exclude_tests = set()
self.valgrind = False
self.dmesg = False
self.monitored = False
diff --git a/framework/profile.py b/framework/profile.py
index e4ba5ec..2e5c084 100644
--- a/framework/profile.py
+++ b/framework/profile.py
@@ -272,7 +272,6 @@ class TestProfile(object):
"""Filter for user-specified restrictions"""
return ((not options.OPTIONS.include_filter or
matches_any_regexp(path, options.OPTIONS.include_filter))
- and path not in options.OPTIONS.exclude_tests
and not matches_any_regexp(path, options.OPTIONS.exclude_filter))
filters = self.filters + [test_matches]
diff --git a/framework/programs/run.py b/framework/programs/run.py
index 5252d6f..e9192bb 100644
--- a/framework/programs/run.py
+++ b/framework/programs/run.py
@@ -391,9 +391,10 @@ def resume(input_):
# Don't re-run tests that have already completed, incomplete status tests
# have obviously not completed.
+ exclude_tests = set()
for name, result in six.iteritems(results.tests):
if args.no_retry or result.result != 'incomplete':
- options.OPTIONS.exclude_tests.add(name)
+ exclude_tests.add(name)
profiles = [profile.load_test_profile(p)
for p in results.options['profile']]
@@ -406,6 +407,8 @@ def resume(input_):
if options.OPTIONS.monitored:
p.monitoring = options.OPTIONS.monitored
+ p.filters.append(lambda n, _: n not in exclude_tests)
+
# This is resumed, don't bother with time since it won't be accurate anyway
profile.run(
profiles,
diff --git a/unittests/framework/test_profile.py b/unittests/framework/test_profile.py
index 4ffabfa..f2aa5b5 100644
--- a/unittests/framework/test_profile.py
+++ b/unittests/framework/test_profile.py
@@ -154,23 +154,6 @@ class TestTestProfile(object):
assert dict(profile_.test_list) == baseline
- def test_matches_env_exclude(self):
- """profile.TestProfile.prepare_test_list: 'not path in
- env.exclude_tests'.
- """
- # Pylint can't figure out that self.opts isn't a dict, but an
- # options._Option object.
- self.opts.exclude_tests.add(grouptools.join('group3', 'test5')) # pylint: disable=no-member
-
- baseline = copy.deepcopy(self.data)
- del baseline[grouptools.join('group3', 'test5')]
-
- profile_ = profile.TestProfile()
- profile_.test_list = self.data
- profile_.prepare_test_list()
-
- assert dict(profile_.test_list) == dict(baseline)
-
def test_matches_exclude_mar(self):
"""profile.TestProfile.prepare_test_list: 'not
matches_any_regexp()'.
--
git-series 0.8.10
More information about the Piglit
mailing list