[Piglit] [PATCH v2 12/26] framework/profile: Drop TestProfile.filter_tests

Dylan Baker dylan at pnwbakers.com
Thu Oct 27 21:31:40 UTC 2016


This was just a thin wrapper around the already public
TestProfile.filters list. It seems silly to have such a method when it
does nothing but call self.filters.append.

Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 framework/profile.py | 16 +++-------------
 tests/all.py         |  2 +-
 tests/cpu.py         |  2 +-
 tests/glslparser.py  |  2 +-
 tests/gpu.py         |  4 ++--
 tests/quick.py       |  2 +-
 tests/shader.py      |  2 +-
 tests/xts-render.py  |  2 +-
 8 files changed, 11 insertions(+), 21 deletions(-)

diff --git a/framework/profile.py b/framework/profile.py
index ed8166c..5404833 100644
--- a/framework/profile.py
+++ b/framework/profile.py
@@ -299,16 +299,6 @@ class TestProfile(object):
             raise exceptions.PiglitFatalError(
                 'There are no tests scheduled to run. Aborting run.')
 
-    def filter_tests(self, function):
-        """Filter out tests that return false from the supplied function
-
-        Arguments:
-        function -- a callable that takes two parameters: path, test and
-                    returns whether the test should be included in the test
-                    run or not.
-        """
-        self.filters.append(function)
-
     @contextlib.contextmanager
     def group_manager(self, test_class, group, prefix=None, **default_args):
         """A context manager to make working with flat groups simple.
@@ -394,9 +384,9 @@ class TestProfile(object):
 
         This method creates a copy with references to the original instance
         (using copy.copy), except for the test_list attribute, which is copied
-        using copy.deepcopy, which is necessary to ensure that filter_tests
-        only affects the right instance. This allows profiles to be
-        "subclassed" by other profiles, without modifying the original.
+        using copy.deepcopy, which is necessary to ensure that
+        prepare_test_list only affects the right instance. This allows profiles
+        to be "subclassed" by other profiles, without modifying the original.
         """
         new = copy.copy(self)
         new.test_list = copy.deepcopy(self.test_list)
diff --git a/tests/all.py b/tests/all.py
index e56cae8..2530f60 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -4908,4 +4908,4 @@ with profile.group_manager(
     g(['arb_compute_variable_group_size-minmax'], 'minmax')
 
 if platform.system() is 'Windows':
-    profile.filter_tests(lambda p, _: not p.startswith('glx'))
+    profile.filters.append(lambda p, _: not p.startswith('glx'))
diff --git a/tests/cpu.py b/tests/cpu.py
index 7fc905e..65d9990 100644
--- a/tests/cpu.py
+++ b/tests/cpu.py
@@ -28,4 +28,4 @@ def filter_gpu(name, test):
     return False
 
 
-profile.filter_tests(filter_gpu)
+profile.filters.append(filter_gpu)
diff --git a/tests/glslparser.py b/tests/glslparser.py
index fccc353..5d0facb 100644
--- a/tests/glslparser.py
+++ b/tests/glslparser.py
@@ -11,4 +11,4 @@ __all__ = ['profile']
 
 profile = _profile.copy()  # pylint: disable=invalid-name
 
-profile.filter_tests(lambda _, t: isinstance(t, GLSLParserTest))
+profile.filters.append(lambda _, t: isinstance(t, GLSLParserTest))
diff --git a/tests/gpu.py b/tests/gpu.py
index c9e3d15..fce550c 100644
--- a/tests/gpu.py
+++ b/tests/gpu.py
@@ -14,5 +14,5 @@ __all__ = ['profile']
 profile = _profile.copy()  # pylint: disable=invalid-name
 
 # Remove all parser tests, as they are compiler test
-profile.filter_tests(lambda p, t: not isinstance(t, GLSLParserTest))
-profile.filter_tests(lambda n, _: not n.startswith('asmparsertest'))
+profile.filters.append(lambda p, t: not isinstance(t, GLSLParserTest))
+profile.filters.append(lambda n, _: not n.startswith('asmparsertest'))
diff --git a/tests/quick.py b/tests/quick.py
index 7af9e82..3a02df7 100644
--- a/tests/quick.py
+++ b/tests/quick.py
@@ -38,4 +38,4 @@ with profile.group_manager(
         g(['arb_shader_image_size-builtin', '--quick'], 'builtin')
 
 # These take too long
-profile.filter_tests(lambda n, _: '-explosion' not in n)
+profile.filters.append(lambda n, _: '-explosion' not in n)
diff --git a/tests/shader.py b/tests/shader.py
index ed5635a..d283a57 100644
--- a/tests/shader.py
+++ b/tests/shader.py
@@ -11,4 +11,4 @@ __all__ = ['profile']
 
 profile = _profile.copy()  # pylint: disable=invalid-name
 
-profile.filter_tests(lambda _, t: isinstance(t, (ShaderTest, MultiShaderTest)))
+profile.filters.append(lambda _, t: isinstance(t, (ShaderTest, MultiShaderTest)))
diff --git a/tests/xts-render.py b/tests/xts-render.py
index 234fb2f..d2cd843 100644
--- a/tests/xts-render.py
+++ b/tests/xts-render.py
@@ -39,4 +39,4 @@ def xts_render_filter(path, test):
     return 'xlib9' in path
 
 
-profile.filter_tests(xts_render_filter)
+profile.filters.append(xts_render_filter)
-- 
git-series 0.8.10


More information about the Piglit mailing list