[Piglit] [PATCH 11/11] framework/test/glsl_parser_test.py: add support for GLSL (ES) based skipping.

baker.dylan.c at gmail.com baker.dylan.c at gmail.com
Thu Nov 5 14:16:49 PST 2015


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

On the glslparser profile I see a roughly ~15 second speedup on my HSW
with this patch.

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

diff --git a/framework/test/glsl_parser_test.py b/framework/test/glsl_parser_test.py
index 338d229..d1a461a 100644
--- a/framework/test/glsl_parser_test.py
+++ b/framework/test/glsl_parser_test.py
@@ -77,6 +77,15 @@ class GLSLParserTest(FastSkipMixin, PiglitBaseTest):
 
         super(GLSLParserTest, self).__init__(command, run_concurrent=True)
 
+        glsl = config.get('glsl_version')
+        if glsl:
+            if glsl in ['1.00', '3.00']:
+                self.glsl_es_version = float(glsl)
+            elif glsl.endswith('es'):
+                self.glsl_es_version = float(glsl.split()[0])
+            else:
+                self.glsl_version = float(glsl)
+
         req = config.get('require_extensions')
         if req:
             self.gl_required = set(req.split())
diff --git a/framework/tests/glsl_parser_test_tests.py b/framework/tests/glsl_parser_test_tests.py
index c954e80..b837723 100644
--- a/framework/tests/glsl_parser_test_tests.py
+++ b/framework/tests/glsl_parser_test_tests.py
@@ -378,6 +378,40 @@ def test_get_glslparsertest_gles2():
         yield test, content.format(version)
 
 
+def test_set_glsl_version():
+    """test.glsl_parser_test.GLSLParserTest: sets glsl_version"""
+    rt = {'glsl_version': '4.3'}
+    with mock.patch.object(glsl.GLSLParserTest, '_GLSLParserTest__parser',
+                           mock.Mock(return_value=rt)):
+        with mock.patch.object(glsl.GLSLParserTest,
+                               '_GLSLParserTest__get_command'):
+            with mock.patch('framework.test.glsl_parser_test.super',
+                            mock.Mock()):
+                with mock.patch('framework.test.glsl_parser_test.open',
+                                mock.mock_open()):
+                    with mock.patch('framework.test.glsl_parser_test.os.stat',
+                                    mock.mock_open()):
+                        test = glsl.GLSLParserTest('foo')
+    nt.eq_(test.glsl_version, 4.3)
+
+
+def test_set_glsl_es_version():
+    """test.glsl_parser_test.GLSLParserTest: sets glsl_es_version"""
+    rt = {'glsl_version': '3.00 es'}
+    with mock.patch.object(glsl.GLSLParserTest, '_GLSLParserTest__parser',
+                           mock.Mock(return_value=rt)):
+        with mock.patch.object(glsl.GLSLParserTest,
+                               '_GLSLParserTest__get_command'):
+            with mock.patch('framework.test.glsl_parser_test.super',
+                            mock.Mock()):
+                with mock.patch('framework.test.glsl_parser_test.open',
+                                mock.mock_open()):
+                    with mock.patch('framework.test.glsl_parser_test.os.stat',
+                                    mock.mock_open()):
+                        test = glsl.GLSLParserTest('foo')
+    nt.eq_(test.glsl_es_version, 3.0)
+
+
 def test_set_gl_required():
     """test.glsl_parser_test.GLSLParserTest: sets glsl_es_version"""
     rt = {'require_extensions': 'GL_ARB_foobar GL_EXT_foobar'}
-- 
2.6.2



More information about the Piglit mailing list