[Piglit] [PATCH v2 3/3] framework/test/glsl_parser_test.py: allow forcing the desktop version

baker.dylan.c at gmail.com baker.dylan.c at gmail.com
Mon Nov 9 15:35:18 PST 2015


From: Dylan Baker <baker.dylan.c at gmail.com>

This adds a new environment variable, PIGLIT_FORCE_GLSLPARSER_DESKTOP,
which forces glsl_parser_test.py to use "glslparsertest" for GLES tests
(instead of "glslparsertest_gles2").

This could be used to force testing ES_<ver>_compatibility extensions
even when OpenGL ES tests are being built.

Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 framework/test/glsl_parser_test.py        | 17 ++++++++++-------
 framework/tests/glsl_parser_test_tests.py | 10 ++++++++++
 2 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/framework/test/glsl_parser_test.py b/framework/test/glsl_parser_test.py
index d97b00b..49d9390 100644
--- a/framework/test/glsl_parser_test.py
+++ b/framework/test/glsl_parser_test.py
@@ -39,6 +39,10 @@ _HAS_GL_VERSION = os.path.exists(os.path.join(TEST_BIN_DIR, 'glslparsertest'))
 _HAS_GLES_VERSION = os.path.exists(os.path.join(TEST_BIN_DIR,
                                                 'glslparsertest_gles2'))
 
+# This forces testing with compatibility extensions, even when GLES support is
+# built
+_FORCE_DESKTOP_VERSION = os.environ.get('PIGLIT_FORCE_GLSLPARSER_DESKTOP', False)
+
 
 def _is_gles_version(version):
     """Return True if version is es, otherwsie false."""
@@ -111,15 +115,14 @@ class GLSLParserTest(PiglitBaseTest):
         then the test will be skipped in the python layer.
 
         """
-        if _is_gles_version(version):
-            if _HAS_GLES_VERSION:
-                return 'glslparsertest_gles2'
-            else:
-                return 'glslparsertest'
-
-        if _HAS_GL_VERSION:
+        if (_is_gles_version(version)
+                and _HAS_GLES_VERSION
+                and not _FORCE_DESKTOP_VERSION):
+            return 'glslparsertest_gles2'
+        elif _HAS_GL_VERSION:
             return 'glslparsertest'
         else:
+            # In this case there is no version taht can run the test, skip it
             self.__is_skip = True
             return 'None'
 
diff --git a/framework/tests/glsl_parser_test_tests.py b/framework/tests/glsl_parser_test_tests.py
index 2e0dc76..09d046d 100644
--- a/framework/tests/glsl_parser_test_tests.py
+++ b/framework/tests/glsl_parser_test_tests.py
@@ -392,6 +392,16 @@ def test_get_glslparsertest_gles2():
             test.description = description.format(version)
             yield test, content.format(version), 'glslparsertest'
 
+    description = ("test.glsl_parser_test.GLSLParserTest: "
+                   "gets gl binary if glsl is '{}' and "
+                   "PIGLIT_FORCE_GLSLPARSER_DESKTOP is true")
+
+    with mock.patch('framework.test.glsl_parser_test._HAS_GLES_VERSION', False):
+        with mock.patch('framework.test.glsl_parser_test._FORCE_DESKTOP_VERSION', True):
+            for version in versions:
+                test.description = description.format(version)
+                yield test, content.format(version), 'glslparsertest'
+
 
 @mock.patch('framework.test.glsl_parser_test._HAS_GL_VERSION', False)
 @nt.raises(TestIsSkip)
-- 
2.6.2



More information about the Piglit mailing list