diff --git a/llvm/utils/lit/lit/formats/googletest.py b/llvm/utils/lit/lit/formats/googletest.py --- a/llvm/utils/lit/lit/formats/googletest.py +++ b/llvm/utils/lit/lit/formats/googletest.py @@ -122,24 +122,25 @@ if litConfig.noExecute: return lit.Test.PASS, '' + header = f"Script:\n--\n{' '.join(cmd)}\n--\n" + try: out, err, exitCode = lit.util.executeCommand( cmd, env=test.config.environment, timeout=litConfig.maxIndividualTestTime) except lit.util.ExecuteCommandTimeoutException: return (lit.Test.TIMEOUT, - 'Reached timeout of {} seconds'.format( - litConfig.maxIndividualTestTime) - ) + f'{header}Reached timeout of ' + '{litConfig.maxIndividualTestTime} seconds') if exitCode: - return lit.Test.FAIL, out + err + return lit.Test.FAIL, header + out + err passing_test_line = '[ PASSED ] 1 test.' if passing_test_line not in out: - msg = ('Unable to find %r in gtest output:\n\n%s%s' % - (passing_test_line, out, err)) - return lit.Test.UNRESOLVED, msg + return (lit.Test.UNRESOLVED, + f'{header}Unable to find {passing_test_line}' + ' in gtest output:\n\n{out}{err}') return lit.Test.PASS,'' diff --git a/llvm/utils/lit/tests/googletest-format.py b/llvm/utils/lit/tests/googletest-format.py --- a/llvm/utils/lit/tests/googletest-format.py +++ b/llvm/utils/lit/tests/googletest-format.py @@ -13,8 +13,12 @@ # CHECK: -- Testing: # CHECK: PASS: googletest-format :: {{[Dd]ummy[Ss]ub[Dd]ir}}/OneTest.py/FirstTest.subTestA -# CHECK: FAIL: googletest-format :: {{[Dd]ummy[Ss]ub[Dd]ir}}/OneTest.py/FirstTest.subTestB -# CHECK-NEXT: *** TEST 'googletest-format :: {{[Dd]ummy[Ss]ub[Dd]ir}}/OneTest.py/FirstTest.subTestB' FAILED *** +# CHECK: FAIL: googletest-format :: [[TEST:[Dd]ummy[Ss]ub[Dd]ir/OneTest.py]]/[[FILTER:FirstTest.subTestB]] +# CHECK-NEXT: *** TEST 'googletest-format :: [[TEST]]/[[FILTER]]' FAILED *** +# CHECK-NEXT: Script: +# CHECK-NEXT: -- +# CHECK-NEXT: [[TEST]] --gtest_filter=[[FILTER]] +# CHECK-NEXT: -- # CHECK-NEXT: I am subTest B, I FAIL # CHECK-NEXT: And I have two lines of output # CHECK: *** diff --git a/llvm/utils/lit/tests/googletest-timeout.py b/llvm/utils/lit/tests/googletest-timeout.py --- a/llvm/utils/lit/tests/googletest-timeout.py +++ b/llvm/utils/lit/tests/googletest-timeout.py @@ -19,7 +19,12 @@ # RUN: FileCheck --check-prefix=CHECK-INF < %t.cfgset.out %s # CHECK-INF: -- Testing: -# CHECK-INF: TIMEOUT: googletest-timeout :: {{[Dd]ummy[Ss]ub[Dd]ir}}/OneTest.py/T.InfiniteLoopSubTest +# CHECK-INF: TIMEOUT: googletest-timeout :: [[TEST:[Dd]ummy[Ss]ub[Dd]ir/OneTest\.py]]/[[FILTER:T\.InfiniteLoopSubTest]] +# CHECK-INF-NEXT: ******************** TEST 'googletest-timeout :: [[TEST]]/[[FILTER]]' FAILED ******************** +# CHECK-INF-NEXT: Script: +# CHECK-INF-NEXT: -- +# CHECK-INF-NEXT: [[TEST]] --gtest_filter=[[FILTER]] +# CHECK-INF-NEXT: -- # CHECK-INF: Timed Out: 1 ############################################################################### diff --git a/llvm/utils/lit/tests/googletest-upstream-format.py b/llvm/utils/lit/tests/googletest-upstream-format.py --- a/llvm/utils/lit/tests/googletest-upstream-format.py +++ b/llvm/utils/lit/tests/googletest-upstream-format.py @@ -10,8 +10,12 @@ # CHECK: -- Testing: # CHECK: PASS: googletest-upstream-format :: {{[Dd]ummy[Ss]ub[Dd]ir}}/OneTest.py/FirstTest.subTestA -# CHECK: FAIL: googletest-upstream-format :: {{[Dd]ummy[Ss]ub[Dd]ir}}/OneTest.py/FirstTest.subTestB -# CHECK-NEXT: *** TEST 'googletest-upstream-format :: {{[Dd]ummy[Ss]ub[Dd]ir}}/OneTest.py/FirstTest.subTestB' FAILED *** +# CHECK: FAIL: googletest-upstream-format :: [[TEST:[Dd]ummy[Ss]ub[Dd]ir/OneTest.py]]/[[FILTER:FirstTest.subTestB]] +# CHECK-NEXT: *** TEST 'googletest-upstream-format :: [[TEST]]/[[FILTER]]' FAILED *** +# CHECK-NEXT: Script: +# CHECK-NEXT: -- +# CHECK-NEXT: [[TEST]] --gtest_filter=[[FILTER]] +# CHECK-NEXT: -- # CHECK-NEXT: Running main() from gtest_main.cc # CHECK-NEXT: I am subTest B, I FAIL # CHECK-NEXT: And I have two lines of output