Skip to content

Commit 080ded7

Browse files
committed
[lldb] Use lit.with_system_environment to propagate env variables
Use lit's with_system_environment function to propagate environment variables to the tests. Include the usual suspects, as well as the variables already explicitly forwarded.
1 parent f111dc7 commit 080ded7

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

lldb/test/Shell/lit.cfg.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,14 @@
3838
# test_exec_root: The root path where tests should be run.
3939
config.test_exec_root = os.path.join(config.lldb_obj_root, 'test')
4040

41-
# Propagate reproducer environment vars.
42-
if 'LLDB_CAPTURE_REPRODUCER' in os.environ:
43-
config.environment['LLDB_CAPTURE_REPRODUCER'] = os.environ[
44-
'LLDB_CAPTURE_REPRODUCER']
41+
# Propagate environment vars.
42+
llvm_config.with_system_environment([
43+
'FREEBSD_LEGACY_PLUGIN',
44+
'HOME',
45+
'LLDB_CAPTURE_REPRODUCER',
46+
'TEMP',
47+
'TMP',
48+
])
4549

4650
# Support running the test suite under the lldb-repro wrapper. This makes it
4751
# possible to capture a test suite run and then rerun all the test from the
@@ -136,6 +140,3 @@ def calculate_arch_features(arch_string):
136140
can_set_dbregs = False
137141
if can_set_dbregs:
138142
config.available_features.add('dbregs-set')
139-
140-
# pass control variable through
141-
llvm_config.with_system_environment('FREEBSD_LEGACY_PLUGIN')

lldb/test/Unit/lit.cfg.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,15 @@
2323
# it needs to be able to find it at runtime. This is fine if Python is on your
2424
# system PATH, but if it's not, then this unit test executable will fail to run.
2525
# We can solve this by forcing the Python directory onto the system path here.
26-
llvm_config.with_system_environment('PATH')
27-
llvm_config.with_environment('PATH', os.path.dirname(sys.executable), append_path=True)
26+
llvm_config.with_system_environment([
27+
'HOME',
28+
'PATH',
29+
'TEMP',
30+
'TMP',
31+
])
32+
llvm_config.with_environment('PATH',
33+
os.path.dirname(sys.executable),
34+
append_path=True)
2835

2936
# testFormat: The test format to use to interpret tests.
3037
config.test_format = lit.formats.GoogleTest(config.llvm_build_mode, 'Tests')

0 commit comments

Comments
 (0)