-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[lit] Fix shell commands with newlines (#67898)
In PR #65242 (landed as 9e739fd), I claimed that RUN lines cannot contain newlines. Actually, they can after substitution expansion. More generally, a lit config file can define substitutions or preamble commands containing newlines. While both of those cases seem unlikely in practice, [D154987](https://reviews.llvm.org/D154987) proposes PYTHON directives where it seems very likely. Regardless of the use case, without this patch, such newlines break expansion of `%dbg(RUN: at line N)`, and the fix is simple.
- Loading branch information
1 parent
9084934
commit 3dc7039
Showing
8 changed files
with
42 additions
and
4 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
5 changes: 5 additions & 0 deletions
5
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 |
---|---|---|
@@ -1,3 +1,8 @@ | ||
import lit.formats | ||
|
||
config.test_format = lit.formats.ShTest(execute_external=True) | ||
config.substitutions.append(("%{cmds-with-newlines}", """ | ||
echo abc | | ||
FileCheck %s && | ||
false | ||
""")) |
2 changes: 2 additions & 0 deletions
2
llvm/utils/lit/tests/Inputs/shtest-run-at-line/external-shell/run-line-with-newline.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,2 @@ | ||
# RUN: %{cmds-with-newlines} | ||
# CHECK: abc |
5 changes: 5 additions & 0 deletions
5
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 |
---|---|---|
@@ -1,3 +1,8 @@ | ||
import lit.formats | ||
|
||
config.test_format = lit.formats.ShTest(execute_external=False) | ||
config.substitutions.append(("%{cmds-with-newlines}", """ | ||
echo abc | | ||
FileCheck %s && | ||
false | ||
""")) |
2 changes: 2 additions & 0 deletions
2
llvm/utils/lit/tests/Inputs/shtest-run-at-line/internal-shell/run-line-with-newline.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,2 @@ | ||
# RUN: %{cmds-with-newlines} | ||
# CHECK: abc |
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