[Piglit] [PATCH 50/63] framework: add --spirv option

Alejandro PiƱeiro apinheiro at igalia.com
Sat Feb 23 23:45:38 UTC 2019


So when executing shader tests, they will be executed with -spirv.

So for example:
./piglit run tests/shader.py -t ARB_explicit_uniform_location --spirv results/explicit_uniform_location-spirv

Will run all the shader tests for that extension using -spirv.
---
 framework/options.py          | 1 +
 framework/programs/run.py     | 7 +++++++
 framework/test/shader_test.py | 2 ++
 3 files changed, 10 insertions(+)

diff --git a/framework/options.py b/framework/options.py
index 0abe1f63d..fa5de34be 100644
--- a/framework/options.py
+++ b/framework/options.py
@@ -61,6 +61,7 @@ class _Options(object):  # pylint: disable=too-many-instance-attributes
         self.process_isolation = True
         self.jobs = None
         self.force_glsl = False
+        self.spirv = 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 d0a3fcfe9..b3e04ccf8 100644
--- a/framework/programs/run.py
+++ b/framework/programs/run.py
@@ -239,10 +239,15 @@ 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")
 
+    parser.add_argument("--spirv",
+                        action="store_true",
+                        help="Run shader runner tests with the -spirv (try SPIR-V) option")
+
     return parser.parse_args(unparsed)
 
 
@@ -322,6 +327,7 @@ def run(input_):
     options.OPTIONS.process_isolation = args.process_isolation
     options.OPTIONS.jobs = args.jobs
     options.OPTIONS.force_glsl = args.glsl
+    options.OPTIONS.spirv = args.spirv
 
     # Set the platform to pass to waffle
     options.OPTIONS.env['PIGLIT_PLATFORM'] = args.platform
@@ -437,6 +443,7 @@ def resume(input_):
     options.OPTIONS.jobs = args.jobs
     options.OPTIONS.no_retry = args.no_retry
     options.OPTIONS.force_glsl = results.options['force_glsl']
+    options.OPTIONS.spirv = results.options['spirv']
 
     core.get_config(args.config_file)
 
diff --git a/framework/test/shader_test.py b/framework/test/shader_test.py
index 3f6f7bb0f..63d840d0f 100644
--- a/framework/test/shader_test.py
+++ b/framework/test/shader_test.py
@@ -193,6 +193,8 @@ class ShaderTest(FastSkipMixin, PiglitBaseTest):
 
         if options.OPTIONS.force_glsl:
             return [command[0]] + [shaderfile, '-auto', '-fbo', '-glsl']
+        elif options.OPTIONS.spirv:
+            return [command[0]] + [shaderfile, '-auto', '-fbo', '-spirv']
         else:
             return [command[0]] + [shaderfile, '-auto', '-fbo']
 
-- 
2.19.1



More information about the Piglit mailing list