[Piglit] [PATCH 1/2] tests/all.py: Use TESTS_DIR for functions that don't have it

Dylan Baker baker.dylan.c at gmail.com
Wed Apr 6 16:14:29 UTC 2016


TESTS_DIR is an absolute path that points at <piglit directory>/tests,
which is needed to make piglit work when run out of tree (ie, when
installed).

This fixes a number of tests That assume piglit will be run in the root
dir, by adding TEST_DIR to their os.path.join calls. This makes them work
when run from an installed piglit.

cc: thomas.stellard at amd.com
Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 tests/all.py | 51 ++++++++++++++++++++++++++++-----------------------
 1 file changed, 28 insertions(+), 23 deletions(-)

diff --git a/tests/all.py b/tests/all.py
index efd27c7..6261720 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -587,65 +587,70 @@ with profile.group_manager(PiglitGLTest, 'shaders') as g:
     g(['point-vertex-id', 'gl_VertexID', 'gl_InstanceID', 'divisor'])
     g(['glsl-vs-int-attrib'])
     g(['glsl-link-test',
-       os.path.join('shaders', 'glsl-link-initializer-01a.vert'),
-       os.path.join('shaders', 'glsl-link-initializer-01b.vert'), 'pass'],
+       os.path.join(TESTS_DIR, 'shaders', 'glsl-link-initializer-01a.vert'),
+       os.path.join(TESTS_DIR, 'shaders', 'glsl-link-initializer-01b.vert'),
+       'pass'],
       'GLSL link single global initializer, 2 shaders')
     g(['glsl-link-test',
-       os.path.join('shaders', 'glsl-link-initializer-01c.vert'),
-       os.path.join('shaders', 'glsl-link-initializer-01d.vert'),
+       os.path.join(TESTS_DIR, 'shaders', 'glsl-link-initializer-01c.vert'),
+       os.path.join(TESTS_DIR, 'shaders', 'glsl-link-initializer-01d.vert'),
        'pass'],
       'GLSL link matched global initializer, 2 shaders')
     g(['glsl-link-test',
-       os.path.join('shaders', 'glsl-link-initializer-01b.vert'),
-       os.path.join('shaders', 'glsl-link-initializer-01d.vert'),
+       os.path.join(TESTS_DIR, 'shaders', 'glsl-link-initializer-01b.vert'),
+       os.path.join(TESTS_DIR, 'shaders', 'glsl-link-initializer-01d.vert'),
        'fail'],
       'GLSL link mismatched global initializer, 2 shaders')
     g(['glsl-link-test',
-       os.path.join('shaders', 'glsl-link-initializer-01a.vert'),
-       os.path.join('shaders', 'glsl-link-initializer-01b.vert'),
-       os.path.join('shaders', 'glsl-link-initializer-01c.vert'),
+       os.path.join(TESTS_DIR, 'shaders', 'glsl-link-initializer-01a.vert'),
+       os.path.join(TESTS_DIR, 'shaders', 'glsl-link-initializer-01b.vert'),
+       os.path.join(TESTS_DIR, 'shaders', 'glsl-link-initializer-01c.vert'),
        'fail'],
       'GLSL link mismatched global initializer, 3 shaders')
     g(['glsl-link-test',
-       os.path.join('shaders', 'glsl-link-initializer-02a.vert'),
-       os.path.join('shaders', 'glsl-link-initializer-02b.vert'),
+       os.path.join(TESTS_DIR, 'shaders', 'glsl-link-initializer-02a.vert'),
+       os.path.join(TESTS_DIR, 'shaders', 'glsl-link-initializer-02b.vert'),
        'fail'],
       'GLSL link mismatched global const initializer')
     g(['glsl-link-initializer-03'],
       'GLSL link two programs, global initializer')
     g(['glsl-link-test',
-       os.path.join('shaders', 'glsl-link-initializer-05a.vert'),
-       os.path.join('shaders', 'glsl-link-initializer-05b.vert'),
+       os.path.join(TESTS_DIR, 'shaders', 'glsl-link-initializer-05a.vert'),
+       os.path.join(TESTS_DIR, 'shaders', 'glsl-link-initializer-05b.vert'),
        'fail'],
       'GLSL link matched global initializer expression')
     g(['glsl-link-test',
-       os.path.join('shaders', 'glsl-link-initializer-06a.vert'),
-       os.path.join('shaders', 'glsl-link-initializer-06b.vert'),
+       os.path.join(TESTS_DIR, 'shaders', 'glsl-link-initializer-06a.vert'),
+       os.path.join(TESTS_DIR, 'shaders', 'glsl-link-initializer-06b.vert'),
        'fail'],
       'GLSL link mismatched global initializer expression')
     g(['glsl-link-test',
-       os.path.join('shaders', 'glsl-link-invariant-01a.vert'),
-       os.path.join('shaders', 'glsl-link-invariant-01b.vert'),
+       os.path.join(TESTS_DIR, 'shaders', 'glsl-link-invariant-01a.vert'),
+       os.path.join(TESTS_DIR, 'shaders', 'glsl-link-invariant-01b.vert'),
        'fail'],
       'GLSL link mismatched invariant')
     g(['glsl-link-test',
-       os.path.join('shaders', 'glsl-link-centroid-01a.vert'),
-       os.path.join('shaders', 'glsl-link-centroid-01b.vert'),
+       os.path.join(TESTS_DIR, 'shaders', 'glsl-link-centroid-01a.vert'),
+       os.path.join(TESTS_DIR, 'shaders', 'glsl-link-centroid-01b.vert'),
        'fail'],
       'GLSL link mismatched centroid')
     g(['glsl-link-test',
-       os.path.join('shaders', 'glsl-link-struct-array.frag'),
+       os.path.join(TESTS_DIR, 'shaders', 'glsl-link-struct-array.frag'),
        'pass'],
       'GLSL link array-of-struct-of-array')
     g(['glsl-getactiveuniform-count',
-       os.path.join('shaders', 'glsl-getactiveuniform-length.vert'), '1'],
+       os.path.join(TESTS_DIR, 'shaders', 'glsl-getactiveuniform-length.vert'),
+       '1'],
       'glsl-getactiveuniform-count: {}'.format('glsl-getactiveuniform-length'))
     g(['glsl-getactiveuniform-count',
-       os.path.join('shaders', 'glsl-getactiveuniform-ftransform.vert'), '2'],
+       os.path.join(TESTS_DIR, 'shaders',
+                    'glsl-getactiveuniform-ftransform.vert'),
+       '2'],
       'glsl-getactiveuniform-count: {}'.format(
           'glsl-getactiveuniform-ftransform'))
     g(['glsl-getactiveuniform-count',
-       os.path.join('shaders', 'glsl-getactiveuniform-mvp.vert'), '2'],
+       os.path.join(TESTS_DIR, 'shaders', 'glsl-getactiveuniform-mvp.vert'),
+       '2'],
       'glsl-getactiveuniform-count: {}'.format('glsl-getactiveuniform-mvp'))
 
     for subtest in ('interstage', 'intrastage', 'vs-gs'):
-- 
2.8.0



More information about the Piglit mailing list