Skip to content

Commit f83f6f5

Browse files
authored
Fix lit testing to support standalone testing (llvm#170365)
To be able to test lit without having a configuration of LLVM, we need to support invocations that are not going through the lit.site.cfg and thus don't have a llvm_config set-up.
1 parent cb5362a commit f83f6f5

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

llvm/utils/lit/tests/lit.cfg

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ import lit.formats
99
from lit.llvm import llvm_config
1010

1111
# Configuration file for the 'lit' test runner.
12+
# Note that lit can be tested in a "standalone" mode, where it is run
13+
# without using the LLVM build directory.
14+
# In this case the llvm_config object is not available, and we expect
15+
# tools like FileCheck to be available in the PATH.
1216

1317
# name: The name of this test suite.
1418
config.name = "lit"
@@ -39,7 +43,6 @@ lit_path = os.path.abspath(lit_path)
3943

4044
# Required because some tests import the lit module
4145
if llvm_config:
42-
llvm_config.use_default_substitutions()
4346
llvm_config.with_environment("PYTHONPATH", lit_path, append_path=True)
4447
else:
4548
config.environment["PYTHONPATH"] = lit_path

llvm/utils/lit/tests/windows-pools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Create a directory with 20 files and check the number of pools and workers per pool that lit will use.
22

33
# RUN: rm -Rf %t.dir && mkdir -p %t.dir
4-
# RUN: %python -c "for i in range(20): open(rf'%t.dir/file{i}.txt', 'w').write('RUN:')"
4+
# RUN: %{python} -c "for i in range(20): open(rf'%t.dir/file{i}.txt', 'w').write('RUN:')"
55

66
# RUN: echo "import lit.formats" > %t.dir/lit.cfg
77
# RUN: echo "config.name = \"top-level-suite\"" >> %t.dir/lit.cfg

0 commit comments

Comments
 (0)