[Piglit] [PATCH 3/4] framework/test: Use relative paths in the filename for VkRunnerTest

Neil Roberts nroberts at igalia.com
Thu Nov 8 00:52:03 UTC 2018

Previously the filename was the full path to the test. This would
break if the filename was serialized and installed to a different

The code is based on what is done for ASMParserTest. However I have a
suspicion that this won’t work for running generated tests from an
out-of-tree build. In that case the path no longer contains the path
to the build directory. If this really is a problem it will need to be
fixed for ASMParserTest too so it could be done in a separate patch.
In the meantime there aren’t any generated VkRunner tests yet so it’s
not really a problem.
 framework/test/piglit_test.py | 8 ++++----
 tests/vulkan.py               | 3 ++-
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/framework/test/piglit_test.py b/framework/test/piglit_test.py
index 4d3008139..31ee4efc5 100644
--- a/framework/test/piglit_test.py
+++ b/framework/test/piglit_test.py
@@ -243,14 +243,14 @@ class VkRunnerTest(PiglitBaseTest):
                 'vkrunner', 'bin', fallback='vkrunner')
         super(VkRunnerTest, self).__init__(
-            [vkrunner_bin, filename],
+            [vkrunner_bin],
         self.filename = filename
     def command(self):
-        # This is overriden because we don’t want PiglitBaseTest to
-        # prepend TEST_BIN_DIR so that it will look for vkrunner in
+        # self._command is used because we don’t want PiglitBaseTest
+        # to prepend TEST_BIN_DIR so that it will look for vkrunner in
         # the search path.
-        return self._command
+        return self._command + [os.path.join(ROOT_DIR, self.filename)]
diff --git a/tests/vulkan.py b/tests/vulkan.py
index 7058f3108..eed199c55 100644
--- a/tests/vulkan.py
+++ b/tests/vulkan.py
@@ -22,11 +22,12 @@ for basedir in [TESTS_DIR, GENERATED_TESTS_DIR]:
     _basedir = os.path.join(basedir, 'vulkan')
     for dirpath, _, filenames in os.walk(_basedir):
         groupname = grouptools.from_path(os.path.relpath(dirpath, _basedir))
+        dirname = os.path.relpath(dirpath, os.path.join(basedir, '..'))
         for filename in filenames:
             testname, ext = os.path.splitext(filename)
             if ext != '.vk_shader_test':
-            test = VkRunnerTest(os.path.join(dirpath, filename))
+            test = VkRunnerTest(os.path.join(dirname, filename))
             group = grouptools.join(groupname, testname)
             assert group not in profile.test_list, group

More information about the Piglit mailing list