[Piglit] [PATCH] framework/test: allow to set extra args with PIGLIT_VKRUNNER_EXTRA_ARGS

Samuel Pitoiset samuel.pitoiset at gmail.com
Wed Jun 5 18:32:09 UTC 2019


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 at gmail.com>
---
 framework/test/piglit_test.py | 9 ++++++++-
 piglit.conf.example           | 1 +
 2 files changed, 9 insertions(+), 1 deletion(-)

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
-- 
2.21.0



More information about the Piglit mailing list