This if couldn't actually be triggered since Test.command became a property. This assertion is a little different, it is triggered if there is nothing in command (so an empty list or dictionary would fail this assertion). This also means that a test would except rather than skip; since this is probably a python problem not a test problem it makes more sense to assert and draw attention to a python bug.
Signed-off-by: Dylan Baker <[email protected]> --- framework/exectest.py | 119 ++++++++++++++++++++++++-------------------------- 1 file changed, 57 insertions(+), 62 deletions(-) diff --git a/framework/exectest.py b/framework/exectest.py index 8d1dbbf..3c62c0a 100644 --- a/framework/exectest.py +++ b/framework/exectest.py @@ -141,71 +141,66 @@ class Test(object): * For 'returncode', the value will be the numeric exit code/value. * For 'command', the value will be command line program and arguments. """ - if self.command is not None: - results = TestResult() - results['command'] = ' '.join(self.command) - results['environment'] = " ".join( - '{0}="{1}"'.format(k, v) for k, v in self.env.iteritems()) + assert self.command + + results = TestResult() + results['command'] = ' '.join(self.command) + results['environment'] = " ".join( + '{0}="{1}"'.format(k, v) for k, v in self.env.iteritems()) + + if self.check_for_skip_scenario(): + results['result'] = 'skip' + results['out'] = "PIGLIT: {'result': 'skip'}\n" + results['err'] = "" + results['returncode'] = None + return results + + for _ in xrange(5): + out, err, returncode = self.get_command_result() + + # 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") == -1: + break + + results['result'] = 'fail' + out = self.interpret_result(out, returncode, results) + + crash_codes = [ + # Unix: terminated by a signal + -5, # SIGTRAP + -6, # SIGABRT + -8, # SIGFPE (Floating point exception) + -10, # SIGUSR1 + -11, # SIGSEGV (Segmentation fault) + # Windows: + # EXCEPTION_ACCESS_VIOLATION (0xc0000005): + -1073741819, + # EXCEPTION_INT_DIVIDE_BY_ZERO (0xc0000094): + -1073741676 + ] + + if returncode in crash_codes: + results['result'] = 'crash' + elif returncode != 0 and results['result'] == 'pass': + results['result'] = 'warn' - if self.check_for_skip_scenario(): - results['result'] = 'skip' - results['out'] = "PIGLIT: {'result': 'skip'}\n" - results['err'] = "" - results['returncode'] = None - return results - - for _ in xrange(5): - out, err, returncode = self.get_command_result() - - # 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") == -1: - break - - results['result'] = 'fail' - out = self.interpret_result(out, returncode, results) - - crash_codes = [ - # Unix: terminated by a signal - -5, # SIGTRAP - -6, # SIGABRT - -8, # SIGFPE (Floating point exception) - -10, # SIGUSR1 - -11, # SIGSEGV (Segmentation fault) - # Windows: - # EXCEPTION_ACCESS_VIOLATION (0xc0000005): - -1073741819, - # EXCEPTION_INT_DIVIDE_BY_ZERO (0xc0000094): - -1073741676 - ] - - if returncode in crash_codes: - results['result'] = 'crash' - elif returncode != 0 and results['result'] == 'pass': - results['result'] = 'warn' - - if self.ENV.valgrind: - # If the underlying test failed, simply report - # 'skip' for this valgrind test. - if results['result'] != 'pass': - results['result'] = 'skip' - elif returncode == 0: - # Test passes and is valgrind clean. - results['result'] = 'pass' - else: - # Test passed but has valgrind errors. - results['result'] = 'fail' - - results['returncode'] = returncode - results['info'] = unicode("Returncode: {0}\n\nErrors:\n{1}\n\n" - "Output:\n{2}").format(returncode, - err, out) - else: - results = TestResult() - if 'result' not in results: + if self.ENV.valgrind: + # If the underlying test failed, simply report + # 'skip' for this valgrind test. + if results['result'] != 'pass': results['result'] = 'skip' + elif returncode == 0: + # Test passes and is valgrind clean. + results['result'] = 'pass' + else: + # Test passed but has valgrind errors. + results['result'] = 'fail' + results['returncode'] = returncode + results['info'] = unicode("Returncode: {0}\n\nErrors:\n{1}\n\n" + "Output:\n{2}").format(returncode, err, out) return results def check_for_skip_scenario(self): -- 1.9.2 _______________________________________________ Piglit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/piglit
