If there is an error in self._run_command return a flag of either True or False, instead of checking for self.result['result'] == 'skip' in Test.run() for early return check for the returned error flag. This makes the early return mechanism much more flexible and extensible than it was before, especially for mixins and subclasses that whish to extend the _run_command method.
Signed-off-by: Dylan Baker <[email protected]> --- framework/test/base.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/framework/test/base.py b/framework/test/base.py index 5e8afde..808e74e 100644 --- a/framework/test/base.py +++ b/framework/test/base.py @@ -210,12 +210,10 @@ class Test(object): self.result['returncode'] = None return - self._run_command() - - # If the result is skip then the test wasn't run, return early - # This usually is triggered when a test is not built for a specific - # platform - if self.result['result'] == 'skip': + run_error = self._run_command() + if run_error: + # If there was an error self.result should already have been set, + # return early return self.interpret_result() @@ -261,6 +259,11 @@ class Test(object): executable isn't found it sets the result to skip. """ + # if there is an error in run command this will be set to True, if this + # is True then the run test method will return early. If this is set to + # True then self.result should be properly filled out + error = False + # Setup the environment for the test. Environment variables are taken # from the following sources, listed in order of increasing precedence: # @@ -309,6 +312,7 @@ class Test(object): out = "Test executable not found.\n" err = "" returncode = None + error = True else: raise e @@ -330,6 +334,8 @@ class Test(object): self.result['err'] = err.decode('utf-8', 'replace') self.result['returncode'] = returncode + return error + class WindowResizeMixin(object): """ Mixin class that deals with spurious window resizes -- 2.1.2 _______________________________________________ Piglit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/piglit
