[Piglit] [PATCH 03/25] framework: add --glsl option

Alejandro PiƱeiro apinheiro at igalia.com
Tue Apr 17 14:37:09 UTC 2018


So when executing shader tests, they will be executed with -glsl. This
is the force GLSL mode, that is only relevant if the shader test
includes SPIR-V shaders.

So for example:
./piglit run tests/shader.py -t ARB_gl_spirv --glsl results/results

Will try to run all the shader tests for ARB_gl_spirv using GLSL
instead of the default (for that extension) SPIR-V.
---
 framework/options.py          | 1 +
 framework/programs/run.py     | 6 ++++++
 framework/test/shader_test.py | 6 +++++-
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/framework/options.py b/framework/options.py
index 211159a45..c6ff96b7f 100644
--- a/framework/options.py
+++ b/framework/options.py
@@ -58,6 +58,7 @@ class _Options(object):  # pylint: disable=too-many-instance-attributes
         self.sync = False
         self.deqp_mustpass = False
         self.process_isolation = True
+        self.force_glsl = False
 
         # env is used to set some base environment variables that are not going
         # to change across runs, without sending them to os.environ which is
diff --git a/framework/programs/run.py b/framework/programs/run.py
index 14fb764a2..2a6187f70 100644
--- a/framework/programs/run.py
+++ b/framework/programs/run.py
@@ -222,6 +222,10 @@ def _run_parser(input_):
                         type=path.realpath,
                         metavar="<Results Path>",
                         help="Path to results folder")
+    parser.add_argument("--glsl",
+                        action="store_true",
+                        help="Run shader runner tests with the -glsl (force GLSL) option")
+
     return parser.parse_args(unparsed)
 
 
@@ -296,6 +300,7 @@ def run(input_):
     options.OPTIONS.sync = args.sync
     options.OPTIONS.deqp_mustpass = args.deqp_mustpass
     options.OPTIONS.process_isolation = args.process_isolation
+    options.OPTIONS.force_glsl = args.glsl
 
     # Set the platform to pass to waffle
     options.OPTIONS.env['PIGLIT_PLATFORM'] = args.platform
@@ -398,6 +403,7 @@ def resume(input_):
     options.OPTIONS.sync = results.options['sync']
     options.OPTIONS.deqp_mustpass = results.options['deqp_mustpass']
     options.OPTIONS.process_isolation = results.options['process_isolation']
+    options.OPTIONS.force_glsl = results.options['glsl']
 
     core.get_config(args.config_file)
 
diff --git a/framework/test/shader_test.py b/framework/test/shader_test.py
index a3fb8e209..a23783f14 100644
--- a/framework/test/shader_test.py
+++ b/framework/test/shader_test.py
@@ -32,6 +32,7 @@ import re
 
 from framework import exceptions
 from framework import status
+from framework import options
 from .base import ReducedProcessMixin, TestIsSkip
 from .opengl import FastSkipMixin, FastSkip
 from .piglit_test import PiglitBaseTest
@@ -178,7 +179,10 @@ class ShaderTest(FastSkipMixin, PiglitBaseTest):
     @PiglitBaseTest.command.getter
     def command(self):
         """ Add -auto and -fbo to the test command """
-        return self._command + ['-auto', '-fbo']
+        if options.OPTIONS.force_glsl:
+            return self._command + ['-auto', '-fbo', '-glsl']
+        else:
+            return self._command + ['-auto', '-fbo']
 
     @command.setter
     def command(self, new):
-- 
2.14.1



More information about the Piglit mailing list