Bug 1101856 - Part 2: Show the output of failed jstests unless '--no-show-failed' is passed. r=sfink

This commit is contained in:
Emanuel Hoogeveen 2014-11-21 13:38:00 +01:00
parent ccc845d01f
commit 877ed696be
2 changed files with 18 additions and 10 deletions

View File

@ -121,6 +121,8 @@ def parse_args():
help="Print each test's output to the file given by --output-file.")
output_og.add_option('-F', '--failed-only', action='store_true',
help="If a --show-* option is given, only print output for failed tests.")
output_og.add_option('--no-show-failed', action='store_true',
help="Don't print output for failed tests (no-op with --show-output).")
output_og.add_option('-O', '--output-file',
help='Write all output to the given file (default: stdout).')
output_og.add_option('--failure-file',
@ -200,8 +202,6 @@ def parse_args():
except IOError as ex:
raise SystemExit("Failed to open output file: " + str(ex))
options.show = options.show_cmd or options.show_output
# Hide the progress bar if it will get in the way of other output.
options.hide_progress = (options.tinderbox or
not ProgressBar.conservative_isatty() or

View File

@ -129,20 +129,28 @@ class ResultsSink:
dev_label = 'TIMEOUTS'
self.groups.setdefault(dev_label, []).append(result.test.path)
show = self.options.show
if self.options.failed_only and dev_label not in ('REGRESSIONS', 'TIMEOUTS'):
show = False
if show:
if dev_label == 'REGRESSIONS':
show_output = self.options.show_output or not self.options.no_show_failed
elif dev_label == 'TIMEOUTS':
show_output = self.options.show_output
else:
show_output = self.options.show_output and not self.options.failed_only
if dev_label in ('REGRESSIONS', 'TIMEOUTS'):
show_cmd = self.options.show_cmd
else:
show_cmd = self.options.show_cmd and not self.options.failed_only
if show_output or show_cmd:
self.pb.beginline()
if show:
if self.options.show_output:
if show_output:
print('## %s: rc = %d, run time = %f' % (output.test.path, output.rc, output.dt), file=self.fp)
if self.options.show_cmd:
if show_cmd:
print(escape_cmdline(output.cmd), file=self.fp)
if self.options.show_output:
if show_output:
self.fp.write(output.out)
self.fp.write(output.err)