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

Commits:

1 changed file:

Changes:

  • testsuite/driver/testlib.py
    ... ... @@ -1500,9 +1500,12 @@ def _newTestDir(name: TestName, opts: TestOptions, tempdir, dir):
    1500 1500
     def _result_directory(opts: TestOptions) -> str:
    
    1501 1501
         # The test's source directory, relative to the GHC source root, so it reads
    
    1502 1502
         # the same regardless of which directory `make` was invoked from.
    
    1503
    +    srcdir = opts.srcdir
    
    1504
    +    if srcdir is None:
    
    1505
    +        return ''
    
    1503 1506
         try:
    
    1504
    -        return os.path.relpath(opts.srcdir, config.top.parent)
    
    1505
    -    except Exception:
    
    1507
    +        return os.path.relpath(srcdir, config.top.parent)
    
    1508
    +    except ValueError:
    
    1506 1509
             return ''
    
    1507 1510
     
    
    1508 1511
     # -----------------------------------------------------------------------------
    
    ... ... @@ -3563,7 +3566,6 @@ def summary(t: TestRun, file: TextIO, color=False, junit_path: Optional[Path]=No
    3563 3566
     
    
    3564 3567
         if t.unexpected_failures:
    
    3565 3568
             if not too_many_failures:
    
    3566
    -            file.write('Output of unexpected failures:\n\n')
    
    3567 3569
                 printTestOutputSummary(file, t.unexpected_failures, color, junit_path)
    
    3568 3570
             else:
    
    3569 3571
                 where = '; see {}'.format(junit_path) if junit_path else ''
    
    ... ... @@ -3657,6 +3659,11 @@ def printTestOutputSummary(file: TextIO, testInfos, color: bool=False,
    3657 3659
                                junit_path: Optional[Path]=None) -> None:
    
    3658 3660
         # Repeat failing tests' captured output in the summary, so one needn't
    
    3659 3661
         # hunt for it earlier in a possibly very long log; see #16720.
    
    3662
    +    header = '=====> Unexpected failures output summary'
    
    3663
    +    if color:
    
    3664
    +        header = colored(Color.RED, header)
    
    3665
    +    file.write(header + '\n\n')
    
    3666
    +
    
    3660 3667
         where = ', see {}'.format(junit_path) if junit_path else ''
    
    3661 3668
         # Tests that fail identically in several ways (e.g. normal and g1) share one
    
    3662 3669
         # output block, with the ways collected in the header.