diff --git a/js/src/jit-test/jit_test.py b/js/src/jit-test/jit_test.py index 728af57f90f..bc840c5dc3e 100755 --- a/js/src/jit-test/jit_test.py +++ b/js/src/jit-test/jit_test.py @@ -72,8 +72,13 @@ def main(argv): help='set test timeout in seconds') op.add_option('--no-progress', dest='hide_progress', action='store_true', help='hide progress bar') - op.add_option('--tinderbox', dest='tinderbox', action='store_true', - help='Tinderbox-parseable output format') + op.add_option('--tinderbox', dest='format', action='store_const', + const='automation', + help='Use automation-parseable output format') + op.add_option('--format', dest='format', default='none', type='choice', + choices=['automation', 'none'], + help='Output format. Either automation or none' + ' (default %default).') op.add_option('--args', dest='shell_args', default='', help='extra args to pass to the JS shell') op.add_option('-w', '--write-failures', dest='write_failures', diff --git a/js/src/tests/jstests.py b/js/src/tests/jstests.py index f170455ce95..f78df35d7bb 100755 --- a/js/src/tests/jstests.py +++ b/js/src/tests/jstests.py @@ -159,8 +159,13 @@ def parse_args(): 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.') + output_og.add_option('--tinderbox', dest='format', action='store_const', + const='automation', + help='Use automation-parseable output format.') + output_og.add_option('--format', dest='format', default='none', + type='choice', choices=['automation', 'none'], + help='Output format. Either automation or none' + ' (default %default).') op.add_option_group(output_og) special_og = OptionGroup(op, "Special", @@ -239,7 +244,7 @@ def parse_args(): raise SystemExit("Failed to open output file: " + str(ex)) # Hide the progress bar if it will get in the way of other output. - options.hide_progress = (options.tinderbox or + options.hide_progress = (options.format == 'automation' or not ProgressBar.conservative_isatty() or options.hide_progress) diff --git a/js/src/tests/lib/jittests.py b/js/src/tests/lib/jittests.py index 976ac0e59ee..7fb9dce3cfe 100755 --- a/js/src/tests/lib/jittests.py +++ b/js/src/tests/lib/jittests.py @@ -472,8 +472,8 @@ def check_output(out, err, rc, timed_out, test, options): return True -def print_tinderbox(ok, res): - # Output test failures in a TBPL parsable format, eg: +def print_automation_format(ok, res): + # Output test failures in a parsable format suitable for automation, eg: # TEST-RESULT | filename.js | Failure description (code N, args "--foobar") # # Example: @@ -664,7 +664,7 @@ def print_test_summary(num_tests, failures, complete, doing, options): + ('' if complete else ' (partial run -- interrupted by user {})'.format(doing))) - if options.tinderbox: + if options.format == 'automation': num_failures = len(failures) if failures else 0 print('Result summary:') print('Passed: {:d}'.format(num_tests - num_failures)) @@ -723,8 +723,8 @@ def process_test_results(results, num_tests, options): else: pb.message("FAIL - {}".format(res.test.relpath_tests)) - if options.tinderbox: - print_tinderbox(ok, res) + if options.format == 'automation': + print_automation_format(ok, res) n = i + 1 pb.update(n, { diff --git a/js/src/tests/lib/results.py b/js/src/tests/lib/results.py index 006d43e271a..ee2f4c3404a 100644 --- a/js/src/tests/lib/results.py +++ b/js/src/tests/lib/results.py @@ -118,8 +118,8 @@ class ResultsSink: if output.timed_out: self.counts['TIMEOUT'] += 1 if isinstance(output, NullTestOutput): - if self.options.tinderbox: - self.print_tinderbox_result( + if self.options.format == 'automation': + self.print_automation_result( 'TEST-KNOWN-FAIL', output.test, time=output.dt, skip=True) self.counts['SKIP'] += 1 @@ -170,18 +170,18 @@ class ResultsSink: else: self.counts['SKIP'] += 1 - if self.options.tinderbox: + if self.options.format == 'automation': if result.result != TestResult.PASS and len(result.results) > 1: for sub_ok, msg in result.results: tup = (sub_ok, result.test.expect, result.test.random) label = self.LABELS[tup][0] if label == 'TEST-UNEXPECTED-PASS': label = 'TEST-PASS (EXPECTED RANDOM)' - self.print_tinderbox_result( + self.print_automation_result( label, result.test, time=output.dt, message=msg) tup = (result.result, result.test.expect, result.test.random) - self.print_tinderbox_result( + self.print_automation_result( self.LABELS[tup][0], result.test, time=output.dt) return @@ -195,12 +195,12 @@ class ResultsSink: def finish(self, completed): self.pb.finish(completed) - if not self.options.tinderbox: + if not self.options.format == 'automation': self.list(completed) # Conceptually, this maps (test result x test expection) to text labels. # key is (result, expect, random) - # value is (tinderbox label, dev test category) + # value is (automation label, dev test category) LABELS = { (TestResult.CRASH, False, False): ('TEST-UNEXPECTED-FAIL', 'REGRESSIONS'), (TestResult.CRASH, False, True): ('TEST-UNEXPECTED-FAIL', 'REGRESSIONS'), @@ -248,8 +248,8 @@ class ResultsSink: def all_passed(self): return 'REGRESSIONS' not in self.groups and 'TIMEOUTS' not in self.groups - def print_tinderbox_result(self, label, test, message=None, skip=False, - time=None): + def print_automation_result(self, label, test, message=None, skip=False, + time=None): result = label result += " | " + test.path args = []