Both checks for skipping a test can be combined, and doing something
at most N times are best done with a for loop.
---
 framework/exectest.py |   46 ++++++++++++++++------------------------------
 1 fil ändrad, 16 tillägg(+), 30 borttagningar(-)

diff --git a/framework/exectest.py b/framework/exectest.py
index 7fc0c1e..808b082 100644
--- a/framework/exectest.py
+++ b/framework/exectest.py
@@ -82,39 +82,30 @@ class ExecTest(Test):
                for e in self.env:
                        fullenv[e] = str(self.env[e])
 
-               if self.command is not None:
+               if self.skip_test or self.command is None:
+                       results = TestResult()
+                       results['result'] = 'skip'
+                       if self.command is not None:
+                               results['returncode'] = None
+                               results['command'] = ' '.join(self.command)
+               else:
                        command = self.command
 
                        if valgrind:
                                command[:0] = ['valgrind', '--quiet', 
'--error-exitcode=1', '--tool=memcheck']
 
-                       i = 0
-                       while True:
-                               if self.skip_test:
-                                       out = "PIGLIT: {'result': 'skip'}\n"
-                                       err = ""
-                                       returncode = None
-                               else:
-                                       (out, err, returncode) = \
-                                               
self.get_command_result(command, fullenv)
-
-                               # 
https://bugzilla.gnome.org/show_bug.cgi?id=680214 is
-                               # affecting many developers.  If we catch it
-                               # happening, try just re-running the test.
-                               if out.find("Got spurious window resize") >= 0:
-                                       i = i + 1
-                                       if i >= 5:
-                                               break
-                               else:
+                       # https://bugzilla.gnome.org/show_bug.cgi?id=680214 is
+                       # affecting many developers.  If we catch it
+                       # happening, try just re-running the test.
+                       for i in range(5):
+                               (out, err, returncode) = \
+                                       self.get_command_result(command, 
fullenv)
+                               if out.find("Got spurious window resize") < 0:
                                        break
 
                        results = TestResult()
-
-                       if self.skip_test:
-                               results['result'] = 'skip'
-                       else:
-                               results['result'] = 'fail'
-                               out = self.interpretResult(out, returncode, 
results)
+                       results['result'] = 'fail'
+                       out = self.interpretResult(out, returncode, results)
 
                        if returncode is None:
                                pass
@@ -148,11 +139,6 @@ class ExecTest(Test):
 
                        self.handleErr(results, err)
 
-               else:
-                       results = TestResult()
-                       if 'result' not in results:
-                               results['result'] = 'skip'
-
                return results
 
        def check_for_skip_scenario(self, command):
-- 
1.7.10.4

_______________________________________________
Piglit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to