Simon Jakobi pushed to branch wip/sjakobi/T16720 at Glasgow Haskell Compiler / GHC

Commits:

5 changed files:

Changes:

  • testsuite/driver/runtests.py
    ... ... @@ -591,7 +591,7 @@ else:
    591 591
             print(Perf.allow_changes_string([(m.change, m.stat) for m in t.metrics]))
    
    592 592
             print('-' * 25)
    
    593 593
     
    
    594
    -    summary(t, sys.stdout, color=term_color.enable_color)
    
    594
    +    summary(t, sys.stdout, color=term_color.enable_color, junit_path=args.junit)
    
    595 595
     
    
    596 596
         # Write perf stats if any exist or if a metrics file is specified.
    
    597 597
         stats_metrics = [stat for (_, stat, __) in t.metrics] # type: List[PerfStat]
    

  • testsuite/driver/testlib.py
    ... ... @@ -3527,9 +3527,22 @@ def findTFiles(roots: List[str]) -> Iterator[str]:
    3527 3527
     # -----------------------------------------------------------------------------
    
    3528 3528
     # Output a test summary to the specified file object
    
    3529 3529
     
    
    3530
    -def summary(t: TestRun, file: TextIO, color=False) -> None:
    
    3530
    +def summary(t: TestRun, file: TextIO, color=False, junit_path: Optional[Path]=None) -> None:
    
    3531 3531
     
    
    3532 3532
         file.write('\n')
    
    3533
    +
    
    3534
    +    if t.unexpected_failures:
    
    3535
    +        if len(t.unexpected_failures) > MAX_SUMMARY_OUTPUT_TESTS:
    
    3536
    +            # junit.xml only exists when a path was requested (e.g. in CI); don't
    
    3537
    +            # point at a file that a local run never wrote.
    
    3538
    +            where = 'see {}'.format(junit_path) if junit_path \
    
    3539
    +                else 'rerun them individually'
    
    3540
    +            file.write('Output of {} unexpected failures omitted (limit {}); {}.\n\n'
    
    3541
    +                       .format(len(t.unexpected_failures), MAX_SUMMARY_OUTPUT_TESTS, where))
    
    3542
    +        else:
    
    3543
    +            file.write('Output of unexpected failures:\n\n')
    
    3544
    +            printTestOutputSummary(file, t.unexpected_failures, color, junit_path)
    
    3545
    +
    
    3533 3546
         printUnexpectedTests(file,
    
    3534 3547
             [t.unexpected_passes, t.unexpected_failures,
    
    3535 3548
              t.unexpected_stat_failures, t.framework_failures])
    
    ... ... @@ -3596,10 +3609,6 @@ def summary(t: TestRun, file: TextIO, color=False) -> None:
    3596 3609
             file.write('Framework warnings:\n')
    
    3597 3610
             printTestInfosSummary(file, t.framework_warnings)
    
    3598 3611
     
    
    3599
    -    if t.unexpected_failures:
    
    3600
    -        file.write('Output of unexpected failures:\n\n')
    
    3601
    -        printTestOutputSummary(file, t.unexpected_failures, color)
    
    3602
    -
    
    3603 3612
         if stopping():
    
    3604 3613
             file.write('WARNING: Testsuite run was terminated early\n')
    
    3605 3614
     
    
    ... ... @@ -3616,9 +3625,15 @@ def printUnexpectedTests(file: TextIO, testInfoss):
    3616 3625
     # Per-stream cap on a failing test's output repeated in the final summary.
    
    3617 3626
     MAX_SUMMARY_OUTPUT_LINES = 100
    
    3618 3627
     
    
    3619
    -def printTestOutputSummary(file: TextIO, testInfos, color: bool=False) -> None:
    
    3628
    +# Above this many unexpected failures, skip repeating output entirely: the
    
    3629
    +# dump would drown out the summary.
    
    3630
    +MAX_SUMMARY_OUTPUT_TESTS = 20
    
    3631
    +
    
    3632
    +def printTestOutputSummary(file: TextIO, testInfos, color: bool=False,
    
    3633
    +                           junit_path: Optional[Path]=None) -> None:
    
    3620 3634
         # Repeat failing tests' captured output in the summary, so one needn't
    
    3621 3635
         # hunt for it earlier in a possibly very long log; see #16720.
    
    3636
    +    where = ', see {}'.format(junit_path) if junit_path else ''
    
    3622 3637
         for result in sorted(testInfos, key=lambda r: (r.testname.lower(), r.way, r.directory)):
    
    3623 3638
             header = '=====> {}({}) [{}]'.format(result.testname, result.way, result.reason)
    
    3624 3639
             if color:
    
    ... ... @@ -3633,7 +3648,7 @@ def printTestOutputSummary(file: TextIO, testInfos, color: bool=False) -> None:
    3633 3648
                     if len(lines) > MAX_SUMMARY_OUTPUT_LINES:
    
    3634 3649
                         omitted = len(lines) - MAX_SUMMARY_OUTPUT_LINES
    
    3635 3650
                         lines = lines[:MAX_SUMMARY_OUTPUT_LINES] \
    
    3636
    -                        + ['... ({} more lines omitted, see junit.xml)'.format(omitted)]
    
    3651
    +                        + ['... ({} more lines omitted{})'.format(omitted, where)]
    
    3637 3652
                     s = label + '\n' + ''.join(l + '\n' for l in lines)
    
    3638 3653
                     # Test output can contain characters that file's encoding
    
    3639 3654
                     # cannot represent; replace rather than crash (cf safe_print).
    

  • testsuite/tests/codeGen/should_run/cgrun001.stdout
    1
    --42
    1
    +-43

  • testsuite/tests/codeGen/should_run/cgrun002.hs
    1
    -main = print ((f id2) (10 + thirty_two))
    
    1
    +import System.Exit
    
    2
    +import System.IO
    
    3
    +
    
    4
    +main = do
    
    5
    +    print ((f id2) (10 + thirty_two))
    
    6
    +    hPutStrLn stderr "deliberate breakage to test summary output"
    
    7
    +    exitWith (ExitFailure 3)
    
    2 8
       where
    
    3 9
         f x = g x
    
    4 10
           where
    

  • testsuite/tests/numeric/should_run/T18619.stderr
    1 1
     T18619: Uncaught exception ghc-internal:GHC.Internal.Exception.Type.ArithException:
    
    2 2
     
    
    3
    -arithmetic overflow
    3
    +arithmetic underflow