mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-01 05:01:59 +01:00
[lit] Improve consistency when printing test results
This commit is contained in:
parent
3fce01ebae
commit
da1f80b302
@ -238,55 +238,59 @@ def execute_in_tmp_dir(run, lit_config):
|
||||
# FIXME: Re-try after timeout on Windows.
|
||||
lit_config.warning("Failed to delete temp directory '%s'" % tmp_dir)
|
||||
|
||||
|
||||
def print_summary(tests, elapsed, opts):
|
||||
# Status code, summary label, group label
|
||||
groups = [
|
||||
# Successes
|
||||
(lit.Test.UNSUPPORTED, 'Unsupported Tests ', 'Unsupported'),
|
||||
(lit.Test.PASS, 'Expected Passes ', ''),
|
||||
(lit.Test.FLAKYPASS, 'Passes With Retry ', ''),
|
||||
(lit.Test.XFAIL, 'Expected Failures ', 'Expected Failing'),
|
||||
# Failures
|
||||
(lit.Test.UNRESOLVED, 'Unresolved Tests ', 'Unresolved'),
|
||||
(lit.Test.TIMEOUT, 'Individual Timeouts', 'Timed Out'),
|
||||
(lit.Test.FAIL, 'Unexpected Failures', 'Failing'),
|
||||
(lit.Test.XPASS, 'Unexpected Passes ', 'Unexpected Passing')]
|
||||
|
||||
by_code = {code: [] for (code, _, _) in groups}
|
||||
for test in tests:
|
||||
by_code[test.result.code].append(test)
|
||||
|
||||
for (code, _, group_label) in groups:
|
||||
print_group(code, group_label, by_code[code], opts)
|
||||
|
||||
if opts.timeTests and tests:
|
||||
test_times = [(t.getFullName(), t.result.elapsed) for t in tests]
|
||||
lit.util.printHistogram(test_times, title='Tests')
|
||||
|
||||
if not opts.quiet:
|
||||
print('\nTesting Time: %.2fs' % elapsed)
|
||||
for (code, summary_label, _) in groups:
|
||||
print_group_summary(code, summary_label, by_code[code], opts.quiet)
|
||||
|
||||
byCode = {}
|
||||
for test in tests:
|
||||
if test.result.code not in byCode:
|
||||
byCode[test.result.code] = []
|
||||
byCode[test.result.code].append(test)
|
||||
|
||||
# Print each test in any of the failing groups.
|
||||
for title,code in (('Unexpected Passing Tests', lit.Test.XPASS),
|
||||
('Failing Tests', lit.Test.FAIL),
|
||||
('Unresolved Tests', lit.Test.UNRESOLVED),
|
||||
('Unsupported Tests', lit.Test.UNSUPPORTED),
|
||||
('Expected Failing Tests', lit.Test.XFAIL),
|
||||
('Timed Out Tests', lit.Test.TIMEOUT)):
|
||||
def print_group(code, label, tests, opts):
|
||||
if not tests:
|
||||
return
|
||||
if code == lit.Test.PASS:
|
||||
return
|
||||
if (lit.Test.XFAIL == code and not opts.show_xfail) or \
|
||||
(lit.Test.UNSUPPORTED == code and not opts.show_unsupported) or \
|
||||
(lit.Test.UNRESOLVED == code and (opts.max_failures is not None)):
|
||||
continue
|
||||
elts = byCode.get(code)
|
||||
if not elts:
|
||||
continue
|
||||
print('*'*20)
|
||||
print('%s (%d):' % (title, len(elts)))
|
||||
for test in elts:
|
||||
return
|
||||
print('*' * 20)
|
||||
print('%s Tests (%d):' % (label, len(tests)))
|
||||
for test in tests:
|
||||
print(' %s' % test.getFullName())
|
||||
sys.stdout.write('\n')
|
||||
|
||||
if opts.timeTests and tests:
|
||||
# Order by time.
|
||||
test_times = [(test.getFullName(), test.result.elapsed)
|
||||
for test in tests]
|
||||
lit.util.printHistogram(test_times, title='Tests')
|
||||
|
||||
for name,code in (('Expected Passes ', lit.Test.PASS),
|
||||
('Passes With Retry ', lit.Test.FLAKYPASS),
|
||||
('Expected Failures ', lit.Test.XFAIL),
|
||||
('Unsupported Tests ', lit.Test.UNSUPPORTED),
|
||||
('Unresolved Tests ', lit.Test.UNRESOLVED),
|
||||
('Unexpected Passes ', lit.Test.XPASS),
|
||||
('Unexpected Failures', lit.Test.FAIL),
|
||||
('Individual Timeouts', lit.Test.TIMEOUT)):
|
||||
if opts.quiet and not code.isFailure:
|
||||
continue
|
||||
N = len(byCode.get(code,[]))
|
||||
if N:
|
||||
print(' %s: %d' % (name,N))
|
||||
def print_group_summary(code, label, tests, quiet):
|
||||
count = len(tests)
|
||||
if count and (code.isFailure or not quiet):
|
||||
print(' %s: %d' % (label, count))
|
||||
|
||||
|
||||
def write_test_results(tests, lit_config, elapsed, output_path):
|
||||
# TODO(yln): audit: unexecuted tests
|
||||
|
@ -68,22 +68,22 @@
|
||||
# CHECK-NEXT: --
|
||||
# CHECK-NEXT: true
|
||||
# CHECK-NEXT: --
|
||||
# CHECK: Testing Time
|
||||
|
||||
# CHECK: Unexpected Passing Tests (1)
|
||||
# CHECK: shtest-format :: xpass.txt
|
||||
|
||||
# CHECK: Failing Tests (3)
|
||||
# CHECK: shtest-format :: external_shell/fail.txt
|
||||
# CHECK: shtest-format :: external_shell/fail_with_bad_encoding.txt
|
||||
# CHECK: shtest-format :: fail.txt
|
||||
|
||||
# CHECK: Unexpected Passing Tests (1)
|
||||
# CHECK: shtest-format :: xpass.txt
|
||||
|
||||
# CHECK: Testing Time:
|
||||
# CHECK: Unsupported Tests : 4
|
||||
# CHECK: Expected Passes : 7
|
||||
# CHECK: Expected Failures : 4
|
||||
# CHECK: Unsupported Tests : 4
|
||||
# CHECK: Unresolved Tests : 3
|
||||
# CHECK: Unexpected Passes : 1
|
||||
# CHECK: Unexpected Failures: 3
|
||||
# CHECK: Unexpected Passes : 1
|
||||
|
||||
|
||||
# XUNIT: <?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user