Bug 1162456 - Part 1: Add --format option in jstests.py and jit_test.py as a replacement for --tinderbox. r=sfink

This commit is contained in:
Tooru Fujisawa 2015-05-08 05:05:42 +09:00
parent 09504ce74e
commit e32fa29dfd
4 changed files with 29 additions and 19 deletions

View File

@ -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',

View File

@ -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)

View File

@ -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, {

View File

@ -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 = []