Skip to content

Commit d76d639

Browse files
authored
[profcheck] Change the FileCheck substitute command (#156985)
The intent of the original regex doesn't work if, for example, the last RUN line was a pipe and FileCheck is in the next RUN line. See for example [`function-specialization3.ll`](https://github.com/llvm/llvm-project/blob/a7c2ce6009a8034ebbf718c12a6e56c085036b57/llvm/test/Transforms/FunctionSpecialization/function-specialization3.ll). To fix this we just replace the redirerect stdout to `/dev/null` with `cat > /dev/null`, which works because it's effectively a no-op command that can be piped to or run standalone. Tracking issue: #147390
1 parent a070dbb commit d76d639

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

llvm/test/lit.cfg.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
# testFormat: The test format to use to interpret tests.
2121
extra_substitutions = extra_substitutions = (
2222
[
23-
(r"\| not FileCheck .*", "> /dev/null"),
24-
(r"\| FileCheck .*", "> /dev/null"),
23+
(r"FileCheck .*", "cat > /dev/null"),
24+
(r"not FileCheck .*", "cat > /dev/null"),
2525
]
2626
if config.enable_profcheck
2727
else []
@@ -39,6 +39,16 @@
3939
# directories.
4040
config.excludes = ["Inputs", "CMakeLists.txt", "README.txt", "LICENSE.txt"]
4141

42+
# Exclude llvm-reduce tests for profcheck because we substitute the FileCheck
43+
# binary with a no-op command for profcheck, but llvm-reduce tests have RUN
44+
# commands of the form llvm-reduce --test FileCheck, which explode if we
45+
# substitute FileCheck because llvm-reduce expects FileCheck in these tests.
46+
# It's not really possible to exclude these tests from the command substitution,
47+
# so we just exclude llvm-reduce tests from this config altogether. This should
48+
# be fine though as profcheck config tests are mostly concerned with opt.
49+
if config.enable_profcheck:
50+
config.excludes = config.excludes + ["llvm-reduce"]
51+
4252
# test_source_root: The root path where tests are located.
4353
config.test_source_root = os.path.dirname(__file__)
4454

0 commit comments

Comments
 (0)