[Piglit] [PATCH 4/4] igt: auto-enumerate subtests

Daniel Vetter daniel.vetter at ffwll.ch
Tue Nov 27 11:52:48 PST 2012


This works together with the new subtest infrastructure in
intel-gpu-tools.

Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
---
 tests/igt.tests | 24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/tests/igt.tests b/tests/igt.tests
index 863000a..3c9968f 100644
--- a/tests/igt.tests
+++ b/tests/igt.tests
@@ -46,8 +46,8 @@ igtTestRoot = path.join(path.realpath(path.join(testBinDir, 'igt')), 'tests')
 profile = TestProfile()
 
 class IGTTest(ExecTest):
-    def __init__(self, binary):
-	ExecTest.__init__(self, [path.join(igtTestRoot, binary)])
+    def __init__(self, binary, arguments=[]):
+	ExecTest.__init__(self, [path.join(igtTestRoot, binary)] + arguments)
 
     def interpretResult(self, out, returncode, results):
 	if returncode == 0:
@@ -93,7 +93,23 @@ singleTests = listTests("list-single-tests")
 for test in singleTests:
     profile.test_list['igt/' + test] = IGTTest(test)
 
+def addSubTestCases(test):
+    proc = subprocess.Popen(
+	    [path.join(igtTestRoot, test), '--list-subtests' ],
+	    stdout=subprocess.PIPE,
+	    stderr=subprocess.PIPE,
+	    env=os.environ.copy(),
+	    universal_newlines=True
+	    )
+    out, err = proc.communicate()
+    returncode = proc.returncode
+
+    subtests = out.split("\n")
+
+    for subtest in subtests:
+	profile.test_list['igt/' + test + '/' + subtest] = IGTTest(test, ['--run-subtest', subtest])
+
 multiTests = listTests("list-multi-tests")
 
-for test in singleTests:
-    profile.test_list['igt/' + test] = IGTTest(test)
+for test in multiTests:
+    addSubTestCases(test)
-- 
1.7.11.7



More information about the Piglit mailing list