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

Daniel Vetter daniel.vetter at ffwll.ch
Tue Nov 27 13:10:41 PST 2012


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

v2: An empty string crept into the subtest list, resulting in a
testcase failure. Filter it out.

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

diff --git a/tests/igt.tests b/tests/igt.tests
index 863000a..c58e439 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,25 @@ 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:
+	if subtest == "":
+	    continue
+	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