Author: cmtice
Date: 2025-09-09T07:11:32-07:00
New Revision: 1f783d739611e187aff70fde43b968c82fe2ff48

URL: 
https://github.com/llvm/llvm-project/commit/1f783d739611e187aff70fde43b968c82fe2ff48
DIFF: 
https://github.com/llvm/llvm-project/commit/1f783d739611e187aff70fde43b968c82fe2ff48.diff

LOG: [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.

Added: 
    

Modified: 
    clang-tools-extra/test/clang-apply-replacements/crlf.cpp
    clang-tools-extra/test/lit.cfg.py

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/test/clang-apply-replacements/crlf.cpp 
b/clang-tools-extra/test/clang-apply-replacements/crlf.cpp
index f40429e354e02..266f806e70b95 100644
--- a/clang-tools-extra/test/clang-apply-replacements/crlf.cpp
+++ b/clang-tools-extra/test/clang-apply-replacements/crlf.cpp
@@ -1,5 +1,5 @@
 // RUN: mkdir -p %t.dir/Inputs/crlf
-// RUN: cat %S/Inputs/crlf/crlf.cpp > %t.dir/Inputs/crlf/crlf.cpp
+// RUN: cp %S/Inputs/crlf/crlf.cpp %t.dir/Inputs/crlf/crlf.cpp
 // RUN: sed "s#\$(path)#%/t.dir/Inputs/crlf#" %S/Inputs/crlf/file1.yaml > 
%t.dir/Inputs/crlf/file1.yaml
 // RUN: clang-apply-replacements %t.dir/Inputs/crlf
 // RUN: 
diff  %t.dir/Inputs/crlf/crlf.cpp %S/Inputs/crlf/crlf.cpp.expected

diff  --git a/clang-tools-extra/test/lit.cfg.py 
b/clang-tools-extra/test/lit.cfg.py
index bc82a14a0aed1..b503c659f6022 100644
--- a/clang-tools-extra/test/lit.cfg.py
+++ b/clang-tools-extra/test/lit.cfg.py
@@ -13,7 +13,15 @@
 config.name = "Clang Tools"
 
 # testFormat: The test format to use to interpret tests.
-config.test_format = lit.formats.ShTest(not llvm_config.use_lit_shell)
+# We prefer the lit internal shell which provides a better user experience on
+# failures and is faster unless the user explicitly disables it with
+# LIT_USE_INTERNAL_SHELL=0 env var.
+use_lit_shell = True
+lit_shell_env = os.environ.get("LIT_USE_INTERNAL_SHELL")
+if lit_shell_env:
+    use_lit_shell = lit.util.pythonize_bool(lit_shell_env)
+
+config.test_format = lit.formats.ShTest(not use_lit_shell)
 
 # suffixes: A list of file extensions to treat as test files.
 config.suffixes = [


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to