Skip to content

Commit 1f783d7

Browse files
authored
[clang-tools-extra] Make internal shell the default for lit tests. (#157572)
This patch updates the clang-tools-extra lit test config to use the internal shell by default. This has some performance advantages (~10-15%) and also produces nicer failure output. It also updates one clang-tools-extra test, so that it passes using the internal shell. All the other tests appear to pass using the internal shell.
1 parent 15a05c0 commit 1f783d7

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: mkdir -p %t.dir/Inputs/crlf
2-
// RUN: cat %S/Inputs/crlf/crlf.cpp > %t.dir/Inputs/crlf/crlf.cpp
2+
// RUN: cp %S/Inputs/crlf/crlf.cpp %t.dir/Inputs/crlf/crlf.cpp
33
// RUN: sed "s#\$(path)#%/t.dir/Inputs/crlf#" %S/Inputs/crlf/file1.yaml > %t.dir/Inputs/crlf/file1.yaml
44
// RUN: clang-apply-replacements %t.dir/Inputs/crlf
55
// RUN: diff %t.dir/Inputs/crlf/crlf.cpp %S/Inputs/crlf/crlf.cpp.expected

clang-tools-extra/test/lit.cfg.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,15 @@
1313
config.name = "Clang Tools"
1414

1515
# testFormat: The test format to use to interpret tests.
16-
config.test_format = lit.formats.ShTest(not llvm_config.use_lit_shell)
16+
# We prefer the lit internal shell which provides a better user experience on
17+
# failures and is faster unless the user explicitly disables it with
18+
# LIT_USE_INTERNAL_SHELL=0 env var.
19+
use_lit_shell = True
20+
lit_shell_env = os.environ.get("LIT_USE_INTERNAL_SHELL")
21+
if lit_shell_env:
22+
use_lit_shell = lit.util.pythonize_bool(lit_shell_env)
23+
24+
config.test_format = lit.formats.ShTest(not use_lit_shell)
1725

1826
# suffixes: A list of file extensions to treat as test files.
1927
config.suffixes = [

0 commit comments

Comments
 (0)