[Piglit] [PATCH 1/3] sanity: Fix test names

Jordan Justen jordan.l.justen at intel.com
Fri Sep 28 21:28:10 UTC 2018


I noticed that although the tests ran successfully, the output of
'piglit summary console' did not have proper names.

For example, before:
../../build/debug/piglit/target_api/no_api/tests/tests/fast_color_clear/all-colors: pass

after:
fast_color_clear/all-colors: pass

Cc: Dylan Baker <dylan at pnwbakers.com>
Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
---
 tests/sanity.py | 62 +++++++++++++++++++++++++------------------------
 1 file changed, 32 insertions(+), 30 deletions(-)

diff --git a/tests/sanity.py b/tests/sanity.py
index 6ba80ccbc..ed3aba004 100644
--- a/tests/sanity.py
+++ b/tests/sanity.py
@@ -49,46 +49,48 @@ gen_basepath = os.path.relpath(os.path.join(GENERATED_TESTS_DIR, '..'), basepath
 
 def add_shader_test(shader):
     """Given an adder, creates a group and adds a shader test."""
-    abs_path = os.path.abspath(shader)
+    basedir = TESTS_DIR
+    abs_path = os.path.abspath(os.path.join(basedir, shader))
+    dirpath, filename = os.path.split(os.path.join(basedir, shader))
+    dirname = os.path.relpath(dirpath, basepath)
+    filepath = os.path.join(dirname, filename)
+
     if os.path.commonprefix([abs_path, GENERATED_TESTS_DIR]) == GENERATED_TESTS_DIR:
-        installpath = os.path.relpath(shader, gen_basepath)
+        installpath = os.path.relpath(filepath, gen_basepath)
     else:
         installpath = None
 
-    dirpath = os.path.dirname(shader)
-    groupname = grouptools.from_path(os.path.relpath(
-        dirpath, GENERATED_TESTS_DIR if installpath else TESTS_DIR))
+    groupname = grouptools.from_path(os.path.relpath(dirpath, basedir))
     testname = os.path.splitext(os.path.basename(shader))[0]
-
-    profile.test_list[grouptools.join(groupname, testname)] = \
-        ShaderTest.new(shader, installpath)
+    group = grouptools.join(groupname, testname)
+    profile.test_list[group] = ShaderTest.new(filepath, installpath)
 
 
 profile = TestProfile()
 
 shader_tests = (
-    'tests/fast_color_clear/all-colors.shader_test',
-    'tests/shaders/arb_texture_gather-miplevels.shader_test',
-    'tests/shaders/glsl-algebraic-add-zero.shader_test',
-    'tests/shaders/glsl-derivs-varyings.shader_test',
-    'tests/shaders/glsl-fs-max-3.shader_test',
-    'tests/shaders/glsl-fs-texture2d-branching.shader_test',
-    'tests/shaders/glsl-vs-mat-mul-1.shader_test',
-    'tests/spec/arb_arrays_of_arrays/execution/image_store/basic-imageStore-mixed-const-non-const-uniform-index.shader_test',
-    'tests/spec/arb_arrays_of_arrays/execution/sampler/vs-struct-nonconst.shader_test',
-    'tests/spec/arb_compute_shader/execution/basic-ssbo.shader_test',
-    'tests/spec/arb_compute_shader/execution/shared-atomics.shader_test',
-    'tests/spec/arb_derivative_control/execution/dfdx-dfdy.shader_test',
-    'tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-bitfieldReverse.shader_test',
-    'tests/spec/arb_shader_ballot/execution/fs-readFirstInvocation-uint-loop.shader_test',
-    'tests/spec/arb_shader_group_vote/cs-all.shader_test',
-    'tests/spec/arb_shader_image_load_store/execution/write-to-rendered-image.shader_test',
-    'tests/spec/arb_shader_subroutine/execution/two-subroutines-nested.shader_test',
-    'tests/spec/arb_shader_texture_lod/execution/glsl-fs-shadow2DGradARB-cumulative.shader_test',
-    'tests/spec/arb_tessellation_shader/execution/barrier-patch.shader_test',
-    'tests/spec/arb_tessellation_shader/execution/sanity.shader_test',
-    'tests/spec/glsl-1.50/execution/geometry-basic.shader_test',
-    'tests/spec/oes_viewport_array/viewport-gs-write-simple.shader_test',
+    'fast_color_clear/all-colors.shader_test',
+    'shaders/arb_texture_gather-miplevels.shader_test',
+    'shaders/glsl-algebraic-add-zero.shader_test',
+    'shaders/glsl-derivs-varyings.shader_test',
+    'shaders/glsl-fs-max-3.shader_test',
+    'shaders/glsl-fs-texture2d-branching.shader_test',
+    'shaders/glsl-vs-mat-mul-1.shader_test',
+    'spec/arb_arrays_of_arrays/execution/image_store/basic-imageStore-mixed-const-non-const-uniform-index.shader_test',
+    'spec/arb_arrays_of_arrays/execution/sampler/vs-struct-nonconst.shader_test',
+    'spec/arb_compute_shader/execution/basic-ssbo.shader_test',
+    'spec/arb_compute_shader/execution/shared-atomics.shader_test',
+    'spec/arb_derivative_control/execution/dfdx-dfdy.shader_test',
+    'spec/arb_gpu_shader5/execution/built-in-functions/fs-bitfieldReverse.shader_test',
+    'spec/arb_shader_ballot/execution/fs-readFirstInvocation-uint-loop.shader_test',
+    'spec/arb_shader_group_vote/cs-all.shader_test',
+    'spec/arb_shader_image_load_store/execution/write-to-rendered-image.shader_test',
+    'spec/arb_shader_subroutine/execution/two-subroutines-nested.shader_test',
+    'spec/arb_shader_texture_lod/execution/glsl-fs-shadow2DGradARB-cumulative.shader_test',
+    'spec/arb_tessellation_shader/execution/barrier-patch.shader_test',
+    'spec/arb_tessellation_shader/execution/sanity.shader_test',
+    'spec/glsl-1.50/execution/geometry-basic.shader_test',
+    'spec/oes_viewport_array/viewport-gs-write-simple.shader_test',
 )
 
 for shader_test in shader_tests:
-- 
2.19.0



More information about the Piglit mailing list