[Piglit] [PATCH] framework/test/shader_test: Fix MultiShaderRunner handling of directories

Dylan Baker dylan at pnwbakers.com
Tue Nov 8 23:51:19 UTC 2016

Currently MultiShaderRunner (used with --process-isolation false)
expects each directory will contain either GL, GLES2, or GLES3 shaders.
The barrier between GLES2 and GLES3 is somewhat artificial, since they
can be promoted to GLES3. This patch allows GLES2 and GLES3 shaders to
be run together but still enforces a separation between GLES and GL

cc: Marek Olšák <maraeo at gmail.com>
Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
 framework/test/shader_test.py | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/framework/test/shader_test.py b/framework/test/shader_test.py
index 447e8c0..1966149 100644
--- a/framework/test/shader_test.py
+++ b/framework/test/shader_test.py
@@ -200,7 +200,21 @@ class MultiShaderTest(ReducedProcessMixin, PiglitBaseTest):
             subtest = os.path.basename(os.path.splitext(each)[0]).lower()
             if prog is not None:
-                assert parser.prog == prog
+                # This allows mixing GLES2 and GLES3 shader test files
+                # together. Since GLES2 profiles can be promoted to GLES3, this
+                # is fine.
+                if parser.prog != prog:
+                    # Pylint can't figure out that prog is not None.
+                    if 'gles' in parser.prog and 'gles' in prog:  # pylint: disable=unsupported-membership-test
+                        prog = max(parser.prog, prog)
+                    else:
+                        # The only way we can get here is if one is GLES and
+                        # one is not, since there is only one desktop runner
+                        # and so it will never fail the is parser.prog != prog
+                        # check
+                        raise exceptions.PiglitInternalError(
+                            'GLES and GL shaders in the same command!\n'
+                            'Cannot pick a shader_runner binary!')
                 prog = parser.prog

More information about the Piglit mailing list