[Lldb-commits] [lldb] 080ded7 - [lldb] Use lit.with_system_environment to propagate env variables

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Tue Mar 9 10:44:42 PST 2021


Author: Jonas Devlieghere
Date: 2021-03-09T10:44:34-08:00
New Revision: 080ded7445cc670cf2628e660690a06503d226d7

URL: https://github.com/llvm/llvm-project/commit/080ded7445cc670cf2628e660690a06503d226d7
DIFF: https://github.com/llvm/llvm-project/commit/080ded7445cc670cf2628e660690a06503d226d7.diff

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

Added: 
    

Modified: 
    lldb/test/Shell/lit.cfg.py
    lldb/test/Unit/lit.cfg.py

Removed: 
    


################################################################################
diff  --git a/lldb/test/Shell/lit.cfg.py b/lldb/test/Shell/lit.cfg.py
index 83e3ef6782ad..fb9412b35be8 100644
--- a/lldb/test/Shell/lit.cfg.py
+++ b/lldb/test/Shell/lit.cfg.py
@@ -38,10 +38,14 @@
 # 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 @@ def calculate_arch_features(arch_string):
         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 e53bcd394ca1..69aab2a4a29f 100644
--- a/lldb/test/Unit/lit.cfg.py
+++ b/lldb/test/Unit/lit.cfg.py
@@ -23,8 +23,15 @@
 # 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')


        


More information about the lldb-commits mailing list