[Piglit] [PATCH v2 1/3] glsl_parser_test.py: Fix which versions are sent to glslparsertest_gles2

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


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

There are two versions of glslparsertest, an undecorated one for desktop
OpenGL, and a '_gles2' suffixed one for OpenGL ES. Piglit should pass 3.1
and 3.2 to the '_gles2' version like it does for GLES 2 and GLES 3.0

This also extends the test generator to cover these new cases (and a few
it should have been covering before). It now covers 1.00, 3.00, 3.10,
3.20, 3.00 es, 3.10 es, and 3.20 es.

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

diff --git a/framework/test/glsl_parser_test.py b/framework/test/glsl_parser_test.py
index e5cd542..e31f8ac 100644
--- a/framework/test/glsl_parser_test.py
+++ b/framework/test/glsl_parser_test.py
@@ -34,6 +34,18 @@ __all__ = [
 ]
 
 
+def _is_gles_version(version):
+    """Return True if version is es, otherwsie false."""
+    if isinstance(version, basestring):
+        # GLES 3+ versions should have "es" appended, even though
+        # glslparsertest doesn't honor them.
+        if version.endswith('es'):
+            return True
+        version = float(version)
+
+    return version in [1.0, 3.0, 3.1, 3.2]
+
+
 class GLSLParserNoConfigError(exceptions.PiglitInternalError):
     pass
 
@@ -94,7 +106,7 @@ class GLSLParserTest(PiglitBaseTest):
         # Create the command and pass it into a PiglitTest()
         glsl = config['glsl_version']
         command = [
-            'glslparsertest_gles2' if glsl in ['1.00', '3.00'] else 'glslparsertest',
+            'glslparsertest_gles2' if _is_gles_version(glsl) else 'glslparsertest',
             filepath,
             config['expect_result'],
             config['glsl_version']
diff --git a/framework/tests/glsl_parser_test_tests.py b/framework/tests/glsl_parser_test_tests.py
index 2bb1211..b3ffd0f 100644
--- a/framework/tests/glsl_parser_test_tests.py
+++ b/framework/tests/glsl_parser_test_tests.py
@@ -351,6 +351,9 @@ def test_get_glslparsertest_gles2():
     description = ("test.glsl_parser_test.GLSLParserTest: "
                    "gets gles2 binary if glsl is {}")
 
-    for version in ['1.00', '3.00']:
+    versions = ['1.00', '3.00', '3.10', '3.20', '3.00 es', '3.10 es',
+                '3.20 es']
+
+    for version in versions:
         test.description = description.format(version)
         yield test, content.format(version)
-- 
2.6.2



More information about the Piglit mailing list