Apply path correction to correct argument

Submitted by Simon Richter on Aug. 13, 2019, 12:55 p.m.

Details

Message ID 1565700940-8601-1-git-send-email-Simon.Richter@hogyros.de
State New
Headers show
Series "Apply path correction to correct argument" ( rev: 1 ) in Piglit

Not browsing as part of any series.

Commit Message

Simon Richter Aug. 13, 2019, 12:55 p.m.
This fixes running OpenCL tests under Valgrind, by applying the path
transformation to the argument that the original command turned into.

It would be nice to have a cleaner solution here that doesn't depend on
text substitution, but as long as there is no OpenCL test named "valgrind",
this should work.
---
 framework/test/piglit_test.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Patch hide | download patch | download mbox

diff --git a/framework/test/piglit_test.py b/framework/test/piglit_test.py
index 0881f00a6..ab6de0398 100644
--- a/framework/test/piglit_test.py
+++ b/framework/test/piglit_test.py
@@ -75,8 +75,7 @@  class PiglitBaseTest(ValgrindMixin, Test):
     @Test.command.getter
     def command(self):
         # Prepend TEST_BIN_DIR to the path.
-        cmd = os.path.join(TEST_BIN_DIR, super(PiglitBaseTest, self).command[0])
-        return [cmd] + self._command[1:]
+        return [os.path.join(TEST_BIN_DIR, c) if c == self._command[0] else c for c in super(PiglitBaseTest, self).command ]
 
     def interpret_result(self):
         out = []
@@ -231,8 +230,7 @@  class CLProgramTester(PiglitCLTest):
     @PiglitCLTest.command.getter
     def command(self):
         command = super(CLProgramTester, self).command
-        command.insert(1, os.path.join(ROOT_DIR, self.filename))
-        return command
+        return command + [ os.path.join(ROOT_DIR, self.filename) ]
 
 
 class VkRunnerTest(PiglitBaseTest):