[Piglit] [PATCH 6/6] igt.tests: make use of dmesg

Dylan Baker baker.dylan.c at gmail.com
Tue Nov 12 07:54:04 PST 2013


This patch allows the igt integrated tests to use the new dmesg
implementation.

Signed-off-by: Dylan Baker <baker.dylan.c at gmail.com>
---
 tests/igt.tests | 72 +++++++++++++++++++++++++++++++--------------------------
 1 file changed, 39 insertions(+), 33 deletions(-)

diff --git a/tests/igt.tests b/tests/igt.tests
index fcfb1a3..17dfa6c 100644
--- a/tests/igt.tests
+++ b/tests/igt.tests
@@ -50,44 +50,50 @@ profile = TestProfile()
 
 class IGTTest(ExecTest):
     def __init__(self, binary, arguments=[]):
-	ExecTest.__init__(self, [path.join(igtTestRoot, binary)] + arguments)
+        ExecTest.__init__(self, [path.join(igtTestRoot, binary)] + arguments)
 
     def interpretResult(self, out, returncode, results, dmesg):
-	if returncode == 0:
-	    results['result'] = 'dmesg-warn' if dmesg else 'pass'
-	elif returncode == 77:
-	    results['result'] = 'skip'
-	else:
-	    results['result'] = 'dmesg-fail' if dmesg else 'fail'
-	return out
+        if returncode == 77:
+            results['result'] = 'skip'
+        elif returncode == 0:
+            if dmesg:
+                if dmesg[1]:
+                    results['result'] = 'fail'
+                else:
+                    results['result'] = 'warn'
+            else:
+                results['result'] = 'pass'
+        else:
+            results['result'] = 'fail'
+        return out
 
 def listTests(listname):
     oldDir = os.getcwd()
     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
+        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)
+        os.chdir(oldDir)
 
     lines = out.split('\n')
     found_header = False
     progs = ""
 
     for line in lines:
-	if found_header:
-	    progs = line.split(" ")
-	    break
+        if found_header:
+            progs = line.split(" ")
+            break
 
-	if "TESTLIST" in line:
-	    found_header = True;
+        if "TESTLIST" in line:
+            found_header = True;
 
     return progs
 
@@ -98,21 +104,21 @@ for test in singleTests:
 
 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
-	    )
+            [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[path.join('igt', test, subtest)] = \
+        if subtest == "":
+            continue
+        profile.test_list[path.join('igt', test, subtest)] = \
             IGTTest(test, ['--run-subtest', subtest])
 
 multiTests = listTests("list-multi-tests")
-- 
1.8.1.5



More information about the Piglit mailing list