[libc++][test] Propagate host environment to libc++ test suite
authorMichał Górny <mgorny@moritz.systems>
Wed, 3 Aug 2022 01:52:25 +0000 (21:52 -0400)
committerLouis Dionne <ldionne.2@gmail.com>
Wed, 3 Aug 2022 01:53:03 +0000 (21:53 -0400)
Propagate the complete host environment to the tests run via the new
testconfig. This ensures that all envvars needed e.g. for the compiler
to work correctly are present. This mimics the behavior explicitly
implemented in the legacy config.

https://github.com/llvm/llvm-project/issues/56816

Differential Revision: https://reviews.llvm.org/D130843

libcxx/test/libcxx/selftest/dsl/dsl.sh.py
libcxx/utils/libcxx/test/newconfig.py

index 6ffedad..81fb60a 100644 (file)
@@ -64,6 +64,7 @@ class SetupConfigs(unittest.TestCase):
             params={})
 
         self.config = lit.TestingConfig.TestingConfig.fromdefaults(self.litConfig)
+        self.config.environment = dict(os.environ)
         self.config.test_source_root = SOURCE_ROOT
         self.config.test_exec_root = EXEC_PATH
         self.config.recursiveExpansionLimit = 10
index 2ac5cf2..253f8e8 100644 (file)
@@ -6,6 +6,9 @@
 #
 #===----------------------------------------------------------------------===##
 
+import os
+
+
 def _getSubstitution(substitution, config):
   for (orig, replacement) in config.substitutions:
     if orig == substitution:
@@ -14,6 +17,7 @@ def _getSubstitution(substitution, config):
 
 def configure(parameters, features, config, lit_config):
   note = lambda s: lit_config.note("({}) {}".format(config.name, s))
+  config.environment = dict(os.environ)
 
   # Apply the actions supplied by parameters to the configuration first, since
   # parameters are things that we request explicitly and which might influence