[Piglit] [Patch v2 10/13] tests/gpu.py: Don't use execfile
Dylan Baker
baker.dylan.c at gmail.com
Wed Jan 8 16:25:08 PST 2014
This uses import rather than exefile. It requires a few additional
changes since gpu.py uses some hacky behavior to remove shader_tests
---
framework/core.py | 12 ++++++++++++
tests/gpu.py | 20 ++++++--------------
2 files changed, 18 insertions(+), 14 deletions(-)
diff --git a/framework/core.py b/framework/core.py
index 390474e..b06c841 100644
--- a/framework/core.py
+++ b/framework/core.py
@@ -606,6 +606,18 @@ class TestProfile:
group = group[group_name]
del group[l[-1]]
+ def remove_tests(self, function):
+ """ Remove tests that return true from function
+
+ This is a destructive method, and passing an incorrect function could
+ result in undesired behavior.
+
+ """
+ # What we really want is a dictionary comprehension, but since python
+ # 2.6 is officially supported we can't use one
+ # {k:v for k, v in self.tests.iteritems() if function(v)}
+ self.tests = dict((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..06138fc 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, as they are compiler test
+profile.remove_tests(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