[Piglit] [PATCH 07/35] framework: Use custom class for ASM parser tests

Dylan Baker dylan at pnwbakers.com
Wed Apr 4 22:26:55 UTC 2018


This is going to make serialization easier, since asmparser tests take a
file argument, which must be relative at build time, but absolute at run
time.
---
 framework/test/piglit_test.py | 14 ++++++++++++++
 tests/all.py                  |  6 ++++--
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/framework/test/piglit_test.py b/framework/test/piglit_test.py
index ef3bfdc..c53c3e5 100644
--- a/framework/test/piglit_test.py
+++ b/framework/test/piglit_test.py
@@ -189,3 +189,17 @@ class PiglitCLTest(PiglitBaseTest):  # pylint: disable=too-few-public-methods
     """
     def __init__(self, command, run_concurrent=CL_CONCURRENT, **kwargs):
         super(PiglitCLTest, self).__init__(command, run_concurrent, **kwargs)
+
+
+class ASMParserTest(PiglitBaseTest):
+
+    """Test class for ASM parser tests."""
+
+    def __init__(self, type_, filename):
+        super(ASMParserTest, self).__init__(['asmparsertest', type_])
+        self.filename = filename
+
+    @PiglitBaseTest.command.getter
+    def command(self):
+        command = super(ASMParserTest, self).command
+        return command + [os.path.join(ROOT_DIR, self.filename)]
diff --git a/tests/all.py b/tests/all.py
index 7c8580e..fe4a14c 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -21,6 +21,7 @@ from framework.driver_classifier import DriverClassifier
 from framework.test import (PiglitGLTest, PiglitBaseTest,
                             GLSLParserTest, GLSLParserNoConfigError)
 from framework.test.shader_test import ShaderTest, MultiShaderTest
+from framework.test.piglit_test import ASMParserTest
 from .py_modules.constants import TESTS_DIR, GENERATED_TESTS_DIR
 
 __all__ = ['profile']
@@ -340,6 +341,7 @@ for group, files in six.iteritems(shader_tests):
     else:
         profile.test_list[group] = MultiShaderTest(files)
 
+
 # Collect and add all asmparsertests
 for basedir in [TESTS_DIR, GENERATED_TESTS_DIR]:
     _basedir = os.path.join(basedir, 'asmparsertest', 'shaders')
@@ -353,8 +355,8 @@ for basedir in [TESTS_DIR, GENERATED_TESTS_DIR]:
                 continue
 
             group = grouptools.join(base_group, filename)
-            profile.test_list[group] = PiglitGLTest(
-                ['asmparsertest', type_, os.path.join(dirpath, filename)])
+            profile.test_list[group] = ASMParserTest(
+                type_, os.path.join(dirpath, filename))
 
 # Find and add all apitrace tests.
 classifier = DriverClassifier()
-- 
git-series 0.9.1


More information about the Piglit mailing list