[Piglit] [PATCH 09/12] tests/gpu.py: Don't use execfile

Dylan Baker baker.dylan.c at gmail.com
Mon Dec 23 16:51:46 PST 2013


This uses import rather than exefile. It requires a few additional
changes since gpu.py uses some hacky behavior to remove shader_tests

XXX: This isn't ready to be pushed
---
 framework/core.py |  9 +++++++++
 tests/gpu.py      | 20 ++++++--------------
 2 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/framework/core.py b/framework/core.py
index 28a1ded..cd5c11d 100644
--- a/framework/core.py
+++ b/framework/core.py
@@ -605,6 +605,15 @@ class TestProfile:
             group = group[group_name]
         del group[l[-1]]
 
+    def filter(self, function):
+        """ Remove tests that return true from function
+
+        This is a destructive method, and passing an incorrect function could
+        result in undesired behavior.
+
+        """
+        self.tests = {k:v for k, v in self.tests.iteritems() if function(v)}
+
     def update(self, *profiles):
         """ Updates the contents of this TestProfile instance with another
 
diff --git a/tests/gpu.py b/tests/gpu.py
index 99e1614..18a4b66 100644
--- a/tests/gpu.py
+++ b/tests/gpu.py
@@ -2,23 +2,15 @@
 
 # quick.tests minus compiler tests.
 
-import framework.glsl_parser_test
-import os.path
+from tests.all import profile
+from framework.glsl_parser_test import GLSLParserTest
 
 __all__ = ['profile']
 
-global profile
-
-# Filter out any GLSLParserTest instances, as they're compiler tests.
-def add_glsl_parser_test(group, filepath, test_name):
-    # Dummy version of framework.glsl_parser_test.add_glsl_parser_test
-    pass
-
-# This be done before executing the base test list script
-framework.glsl_parser_test.add_glsl_parser_test = add_glsl_parser_test
-
-
-execfile(os.path.dirname(__file__) + '/quick.py')
+# Remove all glsl_parser_tests
+profile.filter(lambda x: not isinstance(x, GLSLParserTest))
 
 # Drop ARB_vertex_program/ARB_fragment_program compiler tests.
+del profile.tests['spec']['ARB_vertex_program']
+del profile.tests['spec']['ARB_fragment_program']
 del profile.tests['asmparsertest']
-- 
1.8.5.2



More information about the Piglit mailing list