framework/test: allow to set extra args with PIGLIT_VKRUNNER_EXTRA_ARGS

Submitted by Samuel Pitoiset on June 5, 2019, 6:32 p.m.

Details

Message ID 20190605183209.19574-1-samuel.pitoiset@gmail.com
State New
Headers show
Series "framework/test: allow to set extra args with PIGLIT_VKRUNNER_EXTRA_ARGS" ( rev: 1 ) in Piglit

Not browsing as part of any series.

Commit Message

Samuel Pitoiset June 5, 2019, 6:32 p.m.
vkrunner recently added a new option (--device-id=) for selecting
the physical device. This is quite useful in a multi-GPU scenario.

This allows to set some vkrunner options via vkrunner:extra_args
in the configuration file or with PIGLIT_VKRUNNER_EXTRA_ARGS.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
---
 framework/test/piglit_test.py | 9 ++++++++-
 piglit.conf.example           | 1 +
 2 files changed, 9 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/framework/test/piglit_test.py b/framework/test/piglit_test.py
index 166c2f792..152355e3d 100644
--- a/framework/test/piglit_test.py
+++ b/framework/test/piglit_test.py
@@ -243,15 +243,22 @@  class VkRunnerTest(PiglitBaseTest):
             vkrunner_bin = core.PIGLIT_CONFIG.safe_get(
                 'vkrunner', 'bin', fallback='vkrunner')
 
+        extra_args = os.environ.get('PIGLIT_VKRUNNER_EXTRA_ARGS')
+
+        if extra_args is None:
+            extra_args = core.PIGLIT_CONFIG.safe_get(
+                'vkrunner', 'extra_args', fallback='')
+
         super(VkRunnerTest, self).__init__(
             [vkrunner_bin],
             run_concurrent=True)
 
         self.filename = filename
+        self.extra_args = extra_args.split()
 
     @PiglitBaseTest.command.getter
     def command(self):
         # 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 + [os.path.join(ROOT_DIR, self.filename)]
+        return self._command + self.extra_args + [os.path.join(ROOT_DIR, self.filename)]
diff --git a/piglit.conf.example b/piglit.conf.example
index 1877187df..1fd9ebc48 100644
--- a/piglit.conf.example
+++ b/piglit.conf.example
@@ -190,6 +190,7 @@  run_test=./%(test_name)s
 [vkrunner]
 ; Path to the VkRunner executable
 ; bin=/home/neil/local/bin/vkrunner
+; extra_args=--device-id=1
 
 [expected-failures]
 ; Provide a list of test names that are expected to fail.  These tests