[Piglit] [Patch v2 12/13] framework/exectest.py: optimize 'fail' if not result

Dylan Baker baker.dylan.c at gmail.com
Wed Apr 16 20:06:20 PDT 2014


There are several checks that look for the 'result' in self._result and
set it to fail if it's not there. Let's just make the default value of
'result' 'fail' and get rid of all of these checks.

Signed-off-by: Dylan Baker <baker.dylan.c at gmail.com>
---
 framework/exectest.py | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/framework/exectest.py b/framework/exectest.py
index 8847fd8..43c9a99 100644
--- a/framework/exectest.py
+++ b/framework/exectest.py
@@ -60,7 +60,7 @@ class Test(object):
         self.run_concurrent = run_concurrent
         self.command = command
         self.env = {}
-        self.result = TestResult()
+        self.result = TestResult({'result': 'fail'})
 
         # This is a hook for doing some testing on execute right before
         # self.run is called.
@@ -85,8 +85,6 @@ class Test(object):
                 self.run()
                 self.result['time'] = time.time() - time_start
                 self.result = dmesg.update_result(self.result)
-                if 'result' not in self.result:
-                    self.result['result'] = 'fail'
             except:
                 exception = sys.exc_info()
                 self.result['result'] = 'fail'
@@ -288,6 +286,3 @@ class PiglitTest(Test):
         except:
             self.result['result'] = 'fail'
             self.result['note'] = 'Failed to parse result string'
-
-        if 'result' not in self.result:
-            self.result['result'] = 'fail'
-- 
1.9.2



More information about the Piglit mailing list