Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[lit] Report line number for failed RUN command
When debugging test failures with -vv (or -v in the case of the internal shell), this makes it easier to locate the RUN line that failed. For example, clang's test/Driver/linux-ld.c has 892 total RUN lines, and clang's test/Driver/arm-cortex-cpus.c has 424 RUN lines after concatenation for line continuations. When reading the generated shell script, this also makes it easier to locate the RUN line that produced each command. To support reporting RUN line numbers in the case of the internal shell, this patch extends the internal shell to support the null command, ":", except pipelines are not supported. Reviewed By: asmith, delcypher Differential Revision: https://reviews.llvm.org/D44598 llvm-svn: 330755
- Loading branch information
1 parent
080436f
commit 8a47530
Showing
16 changed files
with
155 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
llvm/utils/lit/tests/Inputs/shtest-run-at-line/external-shell/basic.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# RUN: true | ||
# RUN: false | ||
# RUN: true |
11 changes: 11 additions & 0 deletions
11
llvm/utils/lit/tests/Inputs/shtest-run-at-line/external-shell/line-continuation.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# RUN: : first line continued \ | ||
# RUN: to second line | ||
# RUN: echo 'foo bar' \ | ||
# RUN: | FileCheck %s | ||
# RUN: echo \ | ||
# RUN: 'foo baz' \ | ||
# RUN: | FileCheck %s | ||
# RUN: echo 'foo bar' \ | ||
# RUN: | FileCheck %s | ||
|
||
# CHECK: foo bar |
2 changes: 2 additions & 0 deletions
2
llvm/utils/lit/tests/Inputs/shtest-run-at-line/external-shell/lit.local.cfg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import lit.formats | ||
config.test_format = lit.formats.ShTest(execute_external=True) |
3 changes: 3 additions & 0 deletions
3
llvm/utils/lit/tests/Inputs/shtest-run-at-line/internal-shell/basic.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# RUN: true | ||
# RUN: false | ||
# RUN: true |
11 changes: 11 additions & 0 deletions
11
llvm/utils/lit/tests/Inputs/shtest-run-at-line/internal-shell/line-continuation.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# RUN: : first line continued \ | ||
# RUN: to second line | ||
# RUN: echo 'foo bar' \ | ||
# RUN: | FileCheck %s | ||
# RUN: echo \ | ||
# RUN: 'foo baz' \ | ||
# RUN: | FileCheck %s | ||
# RUN: echo 'foo bar' \ | ||
# RUN: | FileCheck %s | ||
|
||
# CHECK: foo bar |
2 changes: 2 additions & 0 deletions
2
llvm/utils/lit/tests/Inputs/shtest-run-at-line/internal-shell/lit.local.cfg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import lit.formats | ||
config.test_format = lit.formats.ShTest(execute_external=False) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import lit.formats | ||
config.name = 'shtest-run-at-line' | ||
config.suffixes = ['.txt'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Check error on an unsupported ":". (cannot be part of a pipeline) | ||
# | ||
# RUN: : | echo "hello" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# Check that -vv makes the line number of the failing RUN command clear. | ||
# (-v is actually sufficient in the case of the internal shell.) | ||
# | ||
# RUN: not %{lit} -j 1 -vv %{inputs}/shtest-run-at-line > %t.out | ||
# RUN: FileCheck --input-file %t.out %s | ||
# | ||
# END. | ||
|
||
|
||
# CHECK: Testing: 4 tests | ||
|
||
|
||
# In the case of the external shell, we check for only RUN lines in stderr in | ||
# case some shell implementations format "set -x" output differently. | ||
|
||
# CHECK-LABEL: FAIL: shtest-run-at-line :: external-shell/basic.txt | ||
|
||
# CHECK: Script: | ||
# CHECK: : 'RUN: at line 1'; true | ||
# CHECK-NEXT: : 'RUN: at line 2'; false | ||
# CHECK-NEXT: : 'RUN: at line 3'; true | ||
|
||
# CHECK: Command Output (stderr) | ||
# CHECK: RUN: at line 1 | ||
# CHECK: RUN: at line 2 | ||
# CHECK-NOT: RUN | ||
|
||
# CHECK-LABEL: FAIL: shtest-run-at-line :: external-shell/line-continuation.txt | ||
|
||
# CHECK: Script: | ||
# CHECK: : 'RUN: at line 1'; : first line continued to second line | ||
# CHECK-NEXT: : 'RUN: at line 3'; echo 'foo bar' | FileCheck | ||
# CHECK-NEXT: : 'RUN: at line 5'; echo 'foo baz' | FileCheck | ||
# CHECK-NEXT: : 'RUN: at line 8'; echo 'foo bar' | FileCheck | ||
|
||
# CHECK: Command Output (stderr) | ||
# CHECK: RUN: at line 1 | ||
# CHECK: RUN: at line 3 | ||
# CHECK: RUN: at line 5 | ||
# CHECK-NOT: RUN | ||
|
||
|
||
# CHECK-LABEL: FAIL: shtest-run-at-line :: internal-shell/basic.txt | ||
|
||
# CHECK: Script: | ||
# CHECK: : 'RUN: at line 1'; true | ||
# CHECK-NEXT: : 'RUN: at line 2'; false | ||
# CHECK-NEXT: : 'RUN: at line 3'; true | ||
|
||
# CHECK: Command Output (stdout) | ||
# CHECK: $ ":" "RUN: at line 1" | ||
# CHECK-NEXT: $ "true" | ||
# CHECK-NEXT: $ ":" "RUN: at line 2" | ||
# CHECK-NEXT: $ "false" | ||
# CHECK-NOT: RUN | ||
|
||
# CHECK-LABEL: FAIL: shtest-run-at-line :: internal-shell/line-continuation.txt | ||
|
||
# CHECK: Script: | ||
# CHECK: : 'RUN: at line 1'; : first line continued to second line | ||
# CHECK-NEXT: : 'RUN: at line 3'; echo 'foo bar' | FileCheck | ||
# CHECK-NEXT: : 'RUN: at line 5'; echo 'foo baz' | FileCheck | ||
# CHECK-NEXT: : 'RUN: at line 8'; echo 'foo bar' | FileCheck | ||
|
||
# CHECK: Command Output (stdout) | ||
# CHECK: $ ":" "RUN: at line 1" | ||
# CHECK-NEXT: $ ":" "first" "line" "continued" "to" "second" "line" | ||
# CHECK-NEXT: $ ":" "RUN: at line 3" | ||
# CHECK-NEXT: $ "echo" "foo bar" | ||
# CHECK-NEXT: $ "FileCheck" "{{.*}}" | ||
# CHECK-NEXT: $ ":" "RUN: at line 5" | ||
# CHECK-NEXT: $ "echo" "foo baz" | ||
# CHECK-NEXT: $ "FileCheck" "{{.*}}" | ||
# CHECK-NOT: RUN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters