[Piglit] [PATCH v4 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
Fri Nov 20 17:37:13 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        |  8 +++++++-
 framework/tests/glsl_parser_test_tests.py | 10 ++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/framework/test/glsl_parser_test.py b/framework/test/glsl_parser_test.py
index 7ab03af..c0dc2cb 100644
--- a/framework/test/glsl_parser_test.py
+++ b/framework/test/glsl_parser_test.py
@@ -39,6 +39,10 @@ __all__ = [
 _HAS_GL_BIN = os.path.exists(os.path.join(TEST_BIN_DIR, 'glslparsertest'))
 _HAS_GLES_BIN = 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."""
@@ -137,7 +141,9 @@ class GLSLParserTest(FastSkipMixin, PiglitBaseTest):
         then the test will be skipped in the python layer.
 
         """
-        if _is_gles_version(version) and _HAS_GLES_BIN:
+        if (_is_gles_version(version)
+                and _HAS_GLES_BIN
+                and not _FORCE_DESKTOP_VERSION):
             return 'glslparsertest_gles2'
         elif _HAS_GL_BIN:
             return 'glslparsertest'
diff --git a/framework/tests/glsl_parser_test_tests.py b/framework/tests/glsl_parser_test_tests.py
index b8e0e20..5e4269d 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_BIN', 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