[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 16 17:27:33 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 a543f52..544e2fe 100644
--- a/framework/test/glsl_parser_test.py
+++ b/framework/test/glsl_parser_test.py
@@ -40,6 +40,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."""
@@ -141,15 +145,14 @@ class GLSLParserTest(FastSkipMixin, 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 4a61a5e..dcdcf5c 100644
--- a/framework/tests/glsl_parser_test_tests.py
+++ b/framework/tests/glsl_parser_test_tests.py
@@ -391,6 +391,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'
+
 
 def test_set_glsl_version():
     """test.glsl_parser_test.GLSLParserTest: sets glsl_version"""
-- 
2.6.2



More information about the Piglit mailing list