| ... |
... |
@@ -27,7 +27,7 @@ from testutil import strip_quotes, lndir, link_or_copy_file, passed, \ |
|
27
|
27
|
failBecause, testing_metrics, residency_testing_metrics, \
|
|
28
|
28
|
stable_perf_counters, \
|
|
29
|
29
|
PassFail, badResult, str_warn, str_removeprefix
|
|
30
|
|
-from term_color import Color, colored
|
|
|
30
|
+from term_color import Color, colored_if
|
|
31
|
31
|
import testutil
|
|
32
|
32
|
from cpu_features import have_cpu_feature
|
|
33
|
33
|
import perf_notes as Perf
|
| ... |
... |
@@ -3569,13 +3569,38 @@ def summary(t: TestRun, file: TextIO, color=False, junit_path: Optional[Path]=No |
|
3569
|
3569
|
printTestOutputSummary(file, t.unexpected_failures, color, junit_path)
|
|
3570
|
3570
|
else:
|
|
3571
|
3571
|
where = '; see {}'.format(junit_path) if junit_path else ''
|
|
3572
|
|
- file.write('Unexpected failures (output omitted, more than {}{}):\n'
|
|
3573
|
|
- .format(MAX_SUMMARY_OUTPUT_TESTS, where))
|
|
|
3572
|
+ header = ('Unexpected failures (output omitted, more than {}{}):'
|
|
|
3573
|
+ .format(MAX_SUMMARY_OUTPUT_TESTS, where))
|
|
|
3574
|
+ file.write(colored_if(color, Color.RED, header) + '\n')
|
|
3574
|
3575
|
printTestInfosSummary(file, t.unexpected_failures)
|
|
3575
|
3576
|
|
|
3576
|
3577
|
printUnexpectedTests(file,
|
|
3577
|
3578
|
[t.unexpected_passes, t.unexpected_failures,
|
|
3578
|
|
- t.unexpected_stat_failures, t.framework_failures])
|
|
|
3579
|
+ t.unexpected_stat_failures, t.framework_failures], color)
|
|
|
3580
|
+
|
|
|
3581
|
+ if t.unexpected_passes:
|
|
|
3582
|
+ header = 'Unexpected passes:'
|
|
|
3583
|
+ file.write(colored_if(color, Color.RED, header) + '\n')
|
|
|
3584
|
+ printTestInfosSummary(file, t.unexpected_passes)
|
|
|
3585
|
+
|
|
|
3586
|
+ if t.unexpected_stat_failures:
|
|
|
3587
|
+ header = 'Unexpected stat failures:'
|
|
|
3588
|
+ file.write(colored_if(color, Color.RED, header) + '\n')
|
|
|
3589
|
+ printTestInfosSummary(file, t.unexpected_stat_failures)
|
|
|
3590
|
+
|
|
|
3591
|
+ if t.framework_failures:
|
|
|
3592
|
+ header = 'Framework failures:'
|
|
|
3593
|
+ file.write(colored_if(color, Color.RED, header) + '\n')
|
|
|
3594
|
+ printTestInfosSummary(file, t.framework_failures)
|
|
|
3595
|
+
|
|
|
3596
|
+ if t.framework_warnings:
|
|
|
3597
|
+ header = 'Framework warnings:'
|
|
|
3598
|
+ file.write(colored_if(color, Color.YELLOW, header) + '\n')
|
|
|
3599
|
+ printTestInfosSummary(file, t.framework_warnings)
|
|
|
3600
|
+
|
|
|
3601
|
+ if stopping():
|
|
|
3602
|
+ warning = 'WARNING: Testsuite run was terminated early'
|
|
|
3603
|
+ file.write(colored_if(color, Color.YELLOW, warning) + '\n')
|
|
3579
|
3604
|
|
|
3580
|
3605
|
if len(t.unexpected_failures) > 0 or \
|
|
3581
|
3606
|
len(t.unexpected_stat_failures) > 0 or \
|
| ... |
... |
@@ -3586,7 +3611,7 @@ def summary(t: TestRun, file: TextIO, color=False, junit_path: Optional[Path]=No |
|
3586
|
3611
|
summary_color = Color.GREEN
|
|
3587
|
3612
|
|
|
3588
|
3613
|
assert t.start_time is not None
|
|
3589
|
|
- summary_header = colored(summary_color, 'SUMMARY') if color else 'SUMMARY'
|
|
|
3614
|
+ summary_header = colored_if(color, summary_color, 'SUMMARY')
|
|
3590
|
3615
|
file.write(summary_header + ' for test run started at '
|
|
3591
|
3616
|
+ t.start_time.strftime("%c %Z") + '\n'
|
|
3592
|
3617
|
+ str(datetime.datetime.now() - t.start_time).rjust(8)
|
| ... |
... |
@@ -3619,32 +3644,14 @@ def summary(t: TestRun, file: TextIO, color=False, junit_path: Optional[Path]=No |
|
3619
|
3644
|
+ ' fragile tests\n'
|
|
3620
|
3645
|
+ '\n')
|
|
3621
|
3646
|
|
|
3622
|
|
- if t.unexpected_passes:
|
|
3623
|
|
- file.write('Unexpected passes:\n')
|
|
3624
|
|
- printTestInfosSummary(file, t.unexpected_passes)
|
|
3625
|
|
-
|
|
3626
|
|
- if t.unexpected_stat_failures:
|
|
3627
|
|
- file.write('Unexpected stat failures:\n')
|
|
3628
|
|
- printTestInfosSummary(file, t.unexpected_stat_failures)
|
|
3629
|
|
-
|
|
3630
|
|
- if t.framework_failures:
|
|
3631
|
|
- file.write('Framework failures:\n')
|
|
3632
|
|
- printTestInfosSummary(file, t.framework_failures)
|
|
3633
|
|
-
|
|
3634
|
|
- if t.framework_warnings:
|
|
3635
|
|
- file.write('Framework warnings:\n')
|
|
3636
|
|
- printTestInfosSummary(file, t.framework_warnings)
|
|
3637
|
|
-
|
|
3638
|
|
- if stopping():
|
|
3639
|
|
- file.write('WARNING: Testsuite run was terminated early\n')
|
|
3640
|
|
-
|
|
3641
|
|
-def printUnexpectedTests(file: TextIO, testInfoss):
|
|
|
3647
|
+def printUnexpectedTests(file: TextIO, testInfoss, color=False):
|
|
3642
|
3648
|
unexpected = set(result.testname
|
|
3643
|
3649
|
for testInfos in testInfoss
|
|
3644
|
3650
|
for result in testInfos
|
|
3645
|
3651
|
if not result.testname.endswith('.T'))
|
|
3646
|
3652
|
if unexpected:
|
|
3647
|
|
- file.write('Unexpected results from:\n')
|
|
|
3653
|
+ header = 'Unexpected results from:'
|
|
|
3654
|
+ file.write(colored_if(color, Color.RED, header) + '\n')
|
|
3648
|
3655
|
file.write('TEST="' + ' '.join(sorted(unexpected)) + '"\n')
|
|
3649
|
3656
|
file.write('\n')
|
|
3650
|
3657
|
|
| ... |
... |
@@ -3661,9 +3668,7 @@ def printTestOutputSummary(file: TextIO, testInfos, color: bool=False, |
|
3661
|
3668
|
# Repeat failing tests' captured output in the summary, so one needn't
|
|
3662
|
3669
|
# hunt for it earlier in a possibly very long log; see #16720.
|
|
3663
|
3670
|
header = '=====> Unexpected failures output summary'
|
|
3664
|
|
- if color:
|
|
3665
|
|
- header = colored(Color.RED, header)
|
|
3666
|
|
- file.write(header + '\n\n')
|
|
|
3671
|
+ file.write(colored_if(color, Color.RED, header) + '\n\n')
|
|
3667
|
3672
|
|
|
3668
|
3673
|
where = ', see {}'.format(junit_path) if junit_path else ''
|
|
3669
|
3674
|
# Tests that fail identically in several ways (e.g. normal and g1) share one
|
| ... |
... |
@@ -3675,28 +3680,23 @@ def printTestOutputSummary(file: TextIO, testInfos, color: bool=False, |
|
3675
|
3680
|
for result, ways in groups.values():
|
|
3676
|
3681
|
header = '=====> {}({}) ({}) [{}]'.format(
|
|
3677
|
3682
|
result.testname, ', '.join(ways), result.directory + os.sep, result.reason)
|
|
3678
|
|
- if color:
|
|
3679
|
|
- header = colored(Color.RED, header)
|
|
3680
|
|
- file.write(header + '\n')
|
|
|
3683
|
+ file.write(colored_if(color, Color.RED, header) + '\n')
|
|
3681
|
3684
|
for stream_name, contents in [('stdout', result.stdout), ('stderr', result.stderr)]:
|
|
3682
|
3685
|
if contents and contents.strip():
|
|
3683
|
3686
|
label = 'Captured {}:'.format(stream_name)
|
|
3684
|
|
- if color:
|
|
3685
|
|
- label = colored(Color.CYAN, label)
|
|
3686
|
3687
|
lines = contents.rstrip('\n').split('\n')
|
|
3687
|
3688
|
if len(lines) > MAX_SUMMARY_OUTPUT_LINES:
|
|
3688
|
3689
|
omitted = len(lines) - MAX_SUMMARY_OUTPUT_LINES
|
|
3689
|
3690
|
lines = lines[:MAX_SUMMARY_OUTPUT_LINES] \
|
|
3690
|
3691
|
+ ['... ({} more lines omitted{})'.format(omitted, where)]
|
|
3691
|
|
- s = label + '\n' + ''.join(l + '\n' for l in lines)
|
|
|
3692
|
+ s = colored_if(color, Color.CYAN, label) + '\n' \
|
|
|
3693
|
+ + ''.join(l + '\n' for l in lines)
|
|
3692
|
3694
|
# Test output can contain characters that file's encoding
|
|
3693
|
3695
|
# cannot represent; replace rather than crash (cf safe_print).
|
|
3694
|
3696
|
enc = getattr(file, 'encoding', None) or 'utf-8'
|
|
3695
|
3697
|
file.write(s.encode(enc, errors='replace').decode(enc))
|
|
3696
|
3698
|
footer = '<===== end of unexpected failures output summary'
|
|
3697
|
|
- if color:
|
|
3698
|
|
- footer = colored(Color.RED, footer)
|
|
3699
|
|
- file.write(footer + '\n\n')
|
|
|
3699
|
+ file.write(colored_if(color, Color.RED, footer) + '\n\n')
|
|
3700
|
3700
|
|
|
3701
|
3701
|
def printTestInfosSummary(file: TextIO, testInfos):
|
|
3702
|
3702
|
for result in sorted(testInfos, key=lambda r: (r.testname.lower(), r.way, r.directory)):
|