Bug 1101856 - Part 2: Show the output of failed jstests unless '--no-show-failed' is passed. r=sfink
authorEmanuel Hoogeveen <emanuel.hoogeveen@gmail.com>
Fri, 21 Nov 2014 13:38:00 +0100
changeset 241369 74b738dc7837f8228745858470d11fbe9b2bce2b
parent 241368 d4d9503e64da010bff52fad567fb5addcc50b809
child 241370 97c40a737bda80ed40fa25ba6e4c69f6fd8789db
push id4311
push userraliiev@mozilla.com
push dateMon, 12 Jan 2015 19:37:41 +0000
treeherdermozilla-beta@150c9fed433b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssfink
bugs1101856
milestone36.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1101856 - Part 2: Show the output of failed jstests unless '--no-show-failed' is passed. r=sfink
js/src/tests/jstests.py
js/src/tests/lib/results.py
--- a/js/src/tests/jstests.py
+++ b/js/src/tests/jstests.py
@@ -116,16 +116,18 @@ def parse_args():
 
     output_og = OptionGroup(op, "Output", "Modify the harness and tests output.")
     output_og.add_option('-s', '--show-cmd', action='store_true',
                          help='Show exact commandline used to run each test.')
     output_og.add_option('-o', '--show-output', action='store_true',
                          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',
                          help='Write all not-passed tests to the given file.')
     output_og.add_option('--no-progress', dest='hide_progress', action='store_true',
                          help='Do not show the progress bar.')
     output_og.add_option('--tinderbox', action='store_true',
                          help='Use tinderbox-parseable output format.')
@@ -195,18 +197,16 @@ def parse_args():
     if options.output_file:
         if not options.show_cmd:
             options.show_output = True
         try:
             options.output_fp = open(options.output_file, 'w')
         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
                              options.hide_progress)
 
     return (options, requested_paths, excluded_paths)
 
 def load_tests(options, requested_paths, excluded_paths):
--- a/js/src/tests/lib/results.py
+++ b/js/src/tests/lib/results.py
@@ -124,30 +124,38 @@ class ResultsSink:
         else:
             result = TestResult.from_output(output)
             tup = (result.result, result.test.expect, result.test.random)
             dev_label = self.LABELS[tup][1]
             if output.timed_out:
                 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)
 
             self.n += 1
 
             if result.result == TestResult.PASS and not result.test.random:
                 self.counts['PASS'] += 1
             elif result.test.expect and not result.test.random: