[Piglit] [PATCH] tests/igt.py: add support for reading the test list from the file system

Thomas Wood thomas.wood at intel.com
Wed Apr 2 08:12:23 PDT 2014


Signed-off-by: Thomas Wood <thomas.wood at intel.com>
---
 tests/igt.py | 41 +++++++++++++++++++++++++----------------
 1 file changed, 25 insertions(+), 16 deletions(-)

diff --git a/tests/igt.py b/tests/igt.py
index f80a6c4..4640814 100644
--- a/tests/igt.py
+++ b/tests/igt.py
@@ -98,21 +98,30 @@ class IGTTest(ExecTest):
 
 def listTests(listname):
     oldDir = os.getcwd()
+
+    lines = None
     try:
-        os.chdir(igtTestRoot)
-        proc = subprocess.Popen(
-                ['make', listname ],
-                stdout=subprocess.PIPE,
-                stderr=subprocess.PIPE,
-                env=os.environ.copy(),
-                universal_newlines=True
-                )
-        out, err = proc.communicate()
-        returncode = proc.returncode
-    finally:
-        os.chdir(oldDir)
-
-    lines = out.split('\n')
+        with open(path.join(igtTestRoot, listname + '.txt')) as f:
+            lines = [ line.rstrip() for line in f.readlines() ]
+    except IOError:
+        pass
+
+    if lines is None:
+        try:
+            os.chdir(igtTestRoot)
+            proc = subprocess.Popen(
+                    ['make', 'list-' + listname ],
+                    stdout=subprocess.PIPE,
+                    stderr=subprocess.PIPE,
+                    env=os.environ.copy(),
+                    universal_newlines=True
+                    )
+            out, err = proc.communicate()
+            lines = out.split('\n')
+            returncode = proc.returncode
+        finally:
+            os.chdir(oldDir)
+
     found_header = False
     progs = ""
 
@@ -126,7 +135,7 @@ def listTests(listname):
 
     return progs
 
-singleTests = listTests("list-single-tests")
+singleTests = listTests("single-tests")
 
 for test in singleTests:
     profile.test_list[path.join('igt', test)] = IGTTest(test)
@@ -150,7 +159,7 @@ def addSubTestCases(test):
         profile.test_list[path.join('igt', test, subtest)] = \
             IGTTest(test, ['--run-subtest', subtest])
 
-multiTests = listTests("list-multi-tests")
+multiTests = listTests("multi-tests")
 
 for test in multiTests:
     addSubTestCases(test)
-- 
1.9.0



More information about the Piglit mailing list