From 080ded7445cc670cf2628e660690a06503d226d7 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Tue, 9 Mar 2021 09:44:32 -0800 Subject: [PATCH] [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. --- lldb/test/Shell/lit.cfg.py | 15 ++++++++------- lldb/test/Unit/lit.cfg.py | 11 +++++++++-- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/lldb/test/Shell/lit.cfg.py b/lldb/test/Shell/lit.cfg.py index 83e3ef6..fb9412b 100644 --- a/lldb/test/Shell/lit.cfg.py +++ b/lldb/test/Shell/lit.cfg.py @@ -38,10 +38,14 @@ config.test_source_root = os.path.dirname(__file__) # test_exec_root: The root path where tests should be run. config.test_exec_root = os.path.join(config.lldb_obj_root, 'test') -# Propagate reproducer environment vars. -if 'LLDB_CAPTURE_REPRODUCER' in os.environ: - config.environment['LLDB_CAPTURE_REPRODUCER'] = os.environ[ - 'LLDB_CAPTURE_REPRODUCER'] +# Propagate environment vars. +llvm_config.with_system_environment([ + 'FREEBSD_LEGACY_PLUGIN', + 'HOME', + 'LLDB_CAPTURE_REPRODUCER', + 'TEMP', + 'TMP', +]) # Support running the test suite under the lldb-repro wrapper. This makes it # possible to capture a test suite run and then rerun all the test from the @@ -136,6 +140,3 @@ if platform.system() == 'NetBSD' and os.geteuid() != 0: can_set_dbregs = False if can_set_dbregs: config.available_features.add('dbregs-set') - -# pass control variable through -llvm_config.with_system_environment('FREEBSD_LEGACY_PLUGIN') diff --git a/lldb/test/Unit/lit.cfg.py b/lldb/test/Unit/lit.cfg.py index e53bcd3..69aab2a 100644 --- a/lldb/test/Unit/lit.cfg.py +++ b/lldb/test/Unit/lit.cfg.py @@ -23,8 +23,15 @@ config.test_exec_root = config.test_source_root # it needs to be able to find it at runtime. This is fine if Python is on your # system PATH, but if it's not, then this unit test executable will fail to run. # We can solve this by forcing the Python directory onto the system path here. -llvm_config.with_system_environment('PATH') -llvm_config.with_environment('PATH', os.path.dirname(sys.executable), append_path=True) +llvm_config.with_system_environment([ + 'HOME', + 'PATH', + 'TEMP', + 'TMP', +]) +llvm_config.with_environment('PATH', + os.path.dirname(sys.executable), + append_path=True) # testFormat: The test format to use to interpret tests. config.test_format = lit.formats.GoogleTest(config.llvm_build_mode, 'Tests') -- 2.7.4