[Piglit] [PATCH 5/9] framework/exectest.py: fix check_for_skip_scenario

Dylan Baker baker.dylan.c at gmail.com
Wed Apr 9 18:27:23 PDT 2014


This makes a couple of changes. First it removes Test.skip_test, which
was set equal to Test.check_for_skip_scenario(). Second, it removes the
unused command argument from check_for_skip_scenario's signature.
Finally it implements a no-op version in Test, and moves the version in
Test to PiglitTest, since it is a native piglit test specific check.
---
 framework/exectest.py | 34 +++++++++++++++++++++++-----------
 1 file changed, 23 insertions(+), 11 deletions(-)

diff --git a/framework/exectest.py b/framework/exectest.py
index ae397f0..6752ee3 100644
--- a/framework/exectest.py
+++ b/framework/exectest.py
@@ -56,11 +56,9 @@ class Test(object):
                 (i.e. the main thread) or from the ConcurrentTestPool threads.
         '''
         self.run_concurrent = run_concurrent
-        self.skip_test = False
         self.command = command
         self.split_command = os.path.split(self._command[0])[1]
         self.env = {}
-        self.skip_test = self.check_for_skip_scenario(command)
 
         # This is a hook for doing some testing on execute right before
         # self.run is called.
@@ -152,8 +150,9 @@ class Test(object):
                                '--tool=memcheck']
 
             i = 0
+            skip = self.check_for_skip_scenario()
             while True:
-                if self.skip_test:
+                if skip:
                     out = "PIGLIT: {'result': 'skip'}\n"
                     err = ""
                     returncode = None
@@ -190,7 +189,7 @@ class Test(object):
 
             results = TestResult()
 
-            if self.skip_test:
+            if skip:
                 results['result'] = 'skip'
             else:
                 results['result'] = 'fail'
@@ -246,13 +245,13 @@ class Test(object):
 
         return results
 
-    def check_for_skip_scenario(self, command):
-        global PIGLIT_PLATFORM
-        if PIGLIT_PLATFORM == 'gbm':
-            if 'glean' == self.split_command:
-                return True
-            if self.split_command.startswith('glx-'):
-                return True
+    def check_for_skip_scenario(self):
+        """ Application specific check for skip
+
+        If this function returns a truthy value then the current test will be
+        skipped. The base version will always return False
+
+        """
         return False
 
     def get_command_result(self, command, fullenv):
@@ -293,6 +292,19 @@ class PiglitTest(Test):
         # Prepend TEST_BIN_DIR to the path.
         self._command[0] = os.path.join(TEST_BIN_DIR, self._command[0])
 
+    def check_for_skip_scenario(self):
+        """ Native Piglit-test specific skip checking
+
+        If we are running on gbm don't run glean or glx- tests
+
+        """
+        if PIGLIT_PLATFORM == 'gbm':
+            if 'glean' == self.split_command:
+                return True
+            if self.split_command.startswith('glx-'):
+                return True
+        return False
+
     def interpret_result(self, out, returncode, results):
         outlines = out.split('\n')
         outpiglit = (s[7:] for s in outlines if s.startswith('PIGLIT:'))
-- 
1.9.1



More information about the Piglit mailing list