[Piglit] [PATCH 14/35] framework/test: Add class for cl-program-tester

Dylan Baker dylan at pnwbakers.com
Wed Apr 4 22:27:02 UTC 2018


These tests need some special handling for serializing, since they take
file paths as arguments.
---
 framework/test/piglit_test.py | 35 +++++++++++++++++++++++++----------
 tests/cl.py                   |  6 +++---
 2 files changed, 28 insertions(+), 13 deletions(-)

diff --git a/framework/test/piglit_test.py b/framework/test/piglit_test.py
index b5c9a53..f5fd0c8 100644
--- a/framework/test/piglit_test.py
+++ b/framework/test/piglit_test.py
@@ -181,16 +181,6 @@ class PiglitGLTest(WindowResizeMixin, PiglitBaseTest):
         self._command = [n for n in new if n not in ['-auto', '-fbo']]
 
 
-class PiglitCLTest(PiglitBaseTest):  # pylint: disable=too-few-public-methods
-    """ OpenCL specific Test class.
-
-    Set concurrency based on CL requirements.
-
-    """
-    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."""
@@ -208,3 +198,28 @@ class ASMParserTest(PiglitBaseTest):
 class BuiltInConstantsTest(PiglitBaseTest):
 
     """Test class for handling built in constants tests."""
+
+
+class PiglitCLTest(PiglitBaseTest):  # pylint: disable=too-few-public-methods
+    """ OpenCL specific Test class.
+
+    Set concurrency based on CL requirements.
+
+    """
+    def __init__(self, command, run_concurrent=CL_CONCURRENT, **kwargs):
+        super(PiglitCLTest, self).__init__(command, run_concurrent, **kwargs)
+
+
+class CLProgramTester(PiglitCLTest):
+
+    """Class for cl-program-tester tests."""
+
+    def __init__(self, filename):
+        super(CLProgramTester, self).__init__(['cl-program-tester'])
+        self.filename = filename
+
+    @PiglitCLTest.command.getter
+    def command(self):
+        command = super(CLProgramTester, self).command
+        command.insert(1, self.filename)
+        return command
diff --git a/tests/cl.py b/tests/cl.py
index 24febe5..2ab3502 100644
--- a/tests/cl.py
+++ b/tests/cl.py
@@ -14,7 +14,7 @@ from __future__ import (
 import os
 
 from framework.profile import TestProfile
-from framework.test import PiglitCLTest
+from framework.test.piglit_test import PiglitCLTest, CLProgramTester
 from framework import grouptools
 from .py_modules.constants import TESTS_DIR, GENERATED_TESTS_DIR
 
@@ -110,8 +110,8 @@ def add_program_test_dir(group, dirpath):
         if ext not in ['.cl', '.program_test']:
             continue
 
-        profile.test_list[grouptools.join(group, testname)] = PiglitCLTest(
-            ['cl-program-tester', os.path.join(dirpath, filename)])
+        profile.test_list[grouptools.join(group, testname)] = CLProgramTester(
+            os.path.join(dirpath, filename))
 
 
 add_program_test_dir(grouptools.join('program', 'build'),
-- 
git-series 0.9.1


More information about the Piglit mailing list