Commit d9337dc1 authored by Camillo Bruni's avatar Camillo Bruni Committed by Commit Bot

[testrunner] Output unexpected passing tests

Passing tests that are marked as fail in a status file are not
immediately visible as such.

- Always show "--- FAILED ---" for failing tests
- Show "--- UNEXPECTED PASS ---" for unexpectedly passing tests

Drive-by-fixes:
- Color failures in red with --progress=color
- Color repro command in yellow with --progress=color

Change-Id: Id43ecec348dbfd4ff627ea6aa4ba458a2e5a8445
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2213434Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68131}
parent 01724ace
......@@ -160,6 +160,11 @@ class TestCase(object):
statusfile.FAIL in self._statusfile_outcomes and
statusfile.CRASH not in self._statusfile_outcomes)
@property
def is_fail(self):
return (statusfile.FAIL in self._statusfile_outcomes and
statusfile.PASS not in self._statusfile_outcomes)
@property
def only_standard_variant(self):
return statusfile.NO_VARIANTS in self._statusfile_outcomes
......
......@@ -243,15 +243,22 @@ class CompactProgressIndicator(ProgressIndicator):
self._clear_line(self._last_status_length)
print_failure_header(test)
if len(stdout):
print(self._templates['stdout'] % stdout)
self.printFormatted('stdout', stdout)
if len(stderr):
print(self._templates['stderr'] % stderr)
print("Command: %s" % result.cmd.to_string(relative=True))
self.printFormatted('stderr', stderr)
self.printFormatted(
'command', "Command: %s" % result.cmd.to_string(relative=True))
if output.HasCrashed():
print("exit code: %s" % output.exit_code_string)
print("--- CRASHED ---")
if output.HasTimedOut():
print("--- TIMEOUT ---")
self.printFormatted(
'failure', "exit code: %s" % output.exit_code_string)
self.printFormatted('failure', "--- CRASHED ---")
elif output.HasTimedOut():
self.printFormatted('failure', "--- TIMEOUT ---")
else:
if test.is_fail:
self.printFormatted('failure', "--- UNEXPECTED PASS ---")
else:
self.printFormatted('failure', "--- FAILED ---")
def finished(self):
self._print_progress('Done')
......@@ -272,12 +279,12 @@ class CompactProgressIndicator(ProgressIndicator):
'mins': int(elapsed) // 60,
'secs': int(elapsed) % 60
}
status = self._truncate(status, 78)
status = self._truncateStatusLine(status, 78)
self._last_status_length = len(status)
print(status, end='')
sys.stdout.flush()
def _truncate(self, string, length):
def _truncateStatusLine(self, string, length):
if length and len(string) > (length - 3):
return string[:(length - 3)] + "..."
else:
......@@ -296,9 +303,19 @@ class ColorProgressIndicator(CompactProgressIndicator):
"\033[31m-%(failed) 4d\033[0m]: %(test)s"),
'stdout': "\033[1m%s\033[0m",
'stderr': "\033[31m%s\033[0m",
'failure': "\033[1;31m%s\033[0m",
'command': "\033[33m%s\033[0m",
}
super(ColorProgressIndicator, self).__init__(templates)
def printFormatted(self, format, string):
print(self._templates[format] % string)
def _truncateStatusLine(self, string, length):
# Add some slack for the color control chars
return super(ColorProgressIndicator, self)._truncateStatusLine(
string, length + 3*9)
def _clear_line(self, last_length):
print("\033[1K\r", end='')
......@@ -308,11 +325,12 @@ class MonochromeProgressIndicator(CompactProgressIndicator):
templates = {
'status_line': ("[%(mins)02i:%(secs)02i|%%%(progress) 4d|"
"+%(passed) 4d|-%(failed) 4d]: %(test)s"),
'stdout': '%s',
'stderr': '%s',
}
super(MonochromeProgressIndicator, self).__init__(templates)
def printFormatted(self, format, string):
print(string)
def _clear_line(self, last_length):
print(("\r" + (" " * last_length) + "\r"), end='')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment