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

Commits:

1 changed file:

Changes:

  • testsuite/driver/testlib.py
    ... ... @@ -2651,7 +2651,7 @@ async def stdout_ok(name: TestName, way: WayName) -> CompareOutput:
    2651 2651
     def read_stdout( name: TestName ) -> str:
    
    2652 2652
         path = in_testdir(name, 'run.stdout')
    
    2653 2653
         if path.exists():
    
    2654
    -        return path.read_text(encoding='UTF-8')
    
    2654
    +        return path.read_text(encoding='UTF-8', errors='replace')
    
    2655 2655
         else:
    
    2656 2656
             return ''
    
    2657 2657
     
    
    ... ... @@ -2681,14 +2681,14 @@ async def stderr_ok(name: TestName, way: WayName) -> CompareOutput:
    2681 2681
     def read_comp_stderr( name: TestName ) -> str:
    
    2682 2682
         path = in_testdir(name, 'comp.stderr')
    
    2683 2683
         if path.exists():
    
    2684
    -        return path.read_text(encoding='UTF-8')
    
    2684
    +        return path.read_text(encoding='UTF-8', errors='replace')
    
    2685 2685
         else:
    
    2686 2686
             return ''
    
    2687 2687
     
    
    2688 2688
     def read_stderr_for( phase: str, name: TestName ) -> str:
    
    2689 2689
         path = in_testdir(name, phase + '.stderr')
    
    2690 2690
         if path.exists():
    
    2691
    -        return path.read_text(encoding='UTF-8')
    
    2691
    +        return path.read_text(encoding='UTF-8', errors='replace')
    
    2692 2692
         else:
    
    2693 2693
             return ''
    
    2694 2694
     
    
    ... ... @@ -3692,20 +3692,21 @@ MAX_SUMMARY_OUTPUT_LINES = 100
    3692 3692
     # would drown out the summary.
    
    3693 3693
     MAX_SUMMARY_OUTPUT_TESTS = 20
    
    3694 3694
     
    
    3695
    -"""
    
    3696
    -Note [Redundant output in test results]
    
    3697
    -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    3698
    -A failing test result carries up to three pieces of output: `diff`, `stdout`
    
    3699
    -and `stderr`. For an output mismatch these overlap: the diff's `+` lines are
    
    3700
    -the very stream that mismatched, normalised. Reporting both would print the
    
    3701
    -same text twice, so the mismatching stream is dropped at the call sites in
    
    3702
    -favour of the diff, which additionally shows what was expected. The *other*
    
    3703
    -stream is kept: on a stdout mismatch, stderr is independent context.
    
    3704
    -
    
    3705
    -The drop is conditional on there being a diff at all: compare_outputs only
    
    3706
    -runs `diff` when config.verbose >= 1, so under -v0 the stream is the only
    
    3707
    -output there is.
    
    3708
    -"""
    
    3695
    +# Note [Redundant output in test results]
    
    3696
    +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    3697
    +# A failing test result carries up to three pieces of output: `diff`, `stdout`
    
    3698
    +# and `stderr`. For an output mismatch these overlap: the diff's `+` lines are
    
    3699
    +# the very stream that mismatched, normalised. Reporting both would print the
    
    3700
    +# same text twice, so the mismatching stream is dropped at the call sites in
    
    3701
    +# favour of the diff, which additionally shows what was expected. The *other*
    
    3702
    +# stream is kept: on a stdout mismatch, stderr is independent context.
    
    3703
    +#
    
    3704
    +# The drop is conditional on there being a diff at all: compare_outputs only
    
    3705
    +# runs `diff` when config.verbose >= 1, so under -v0 the stream is the only
    
    3706
    +# output there is.
    
    3707
    +#
    
    3708
    +# Note that, since the drop happens at result construction, it also affects the
    
    3709
    +# JUnit report (junit.py).
    
    3709 3710
     
    
    3710 3711
     def strip_diff_header(diff: Optional[str]) -> Optional[str]:
    
    3711 3712
         # Drop diff(1)'s ---/+++ lines: they name normalised files in the test