[Piglit] [PATCH] tests/igt.py: don't run tests if the environment check failed

Thomas Wood thomas.wood at intel.com
Tue Jan 27 03:34:17 PST 2015


Allow tests to be enumerated but not run if the environment check fails.
This allows the piglit-print-commands utility to continue to work
correctly, but prevents the tests from being run if the current
environment will cause them to fail. This also helps prevent appending
incorrect results to resumed test runs.

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

diff --git a/tests/igt.py b/tests/igt.py
index e65b8a9..bd4c70e 100644
--- a/tests/igt.py
+++ b/tests/igt.py
@@ -74,9 +74,14 @@ if not (os.path.exists(os.path.join(igtTestRoot, 'single-tests.txt'))
     print "intel-gpu-tools test lists not found."
     sys.exit(0)
 
-igtEnvironmentOk = checkEnvironment()
 
-profile = TestProfile()
+class IGTTestProfile(TestProfile):
+    """ Test profile for intel-gpu-tools tests. """
+    def _pre_run_hook(self):
+        if not checkEnvironment():
+            sys.exit(1)
+
+profile = IGTTestProfile()
 
 class IGTTest(Test):
     def __init__(self, binary, arguments=None):
@@ -87,9 +92,6 @@ class IGTTest(Test):
         self.timeout = 600
 
     def interpret_result(self):
-        if not igtEnvironmentOk:
-            return
-
         if self.result['returncode'] == 0:
             self.result['result'] = 'pass'
         elif self.result['returncode'] == 77:
@@ -99,13 +101,6 @@ class IGTTest(Test):
         else:
             self.result['result'] = 'fail'
 
-    def run(self):
-        if not igtEnvironmentOk:
-            self.result['result'] = 'fail'
-            self.result['info'] = unicode("Test Environment isn't OK")
-            return
-
-        super(IGTTest, self).run()
 
 def listTests(listname):
     with open(os.path.join(igtTestRoot, listname + '.txt'), 'r') as f:
-- 
2.1.0



More information about the Piglit mailing list