Simon Jakobi pushed to branch wip/sjakobi/testsuite-atomic-output at Glasgow Haskell Compiler / GHC

Commits:

1 changed file:

Changes:

  • testsuite/driver/testlib.py
    ... ... @@ -1590,6 +1590,13 @@ async def runTestAtomically(opts, name: TestName, func, args):
    1590 1590
             output_buffer_ctx_var.reset(token)
    
    1591 1591
             s = buf.getvalue()
    
    1592 1592
             if s:
    
    1593
    +            # Set the block apart from adjacent tests' output with a header
    
    1594
    +            # naming the test and a trailing blank line. Without this,
    
    1595
    +            # neighbouring blocks read as one interleaved mess, and output
    
    1596
    +            # of passing tests cannot be attributed to its test at all.
    
    1597
    +            if not s.endswith('\n'):
    
    1598
    +                s += '\n'
    
    1599
    +            s = '=====> output from {}:\n{}\n'.format(name, s)
    
    1593 1600
                 # The event loop is single-threaded and there is no await between
    
    1594 1601
                 # these calls, so the block is written out atomically.
    
    1595 1602
                 sys.stdout.write(s)