aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@moritz.systems>2022-08-02 21:52:25 -0400
committerTom Stellard <tstellar@redhat.com>2022-08-05 01:04:08 -0700
commitb0eab153405eaa29653f86ff13fa1832e0fbf991 (patch)
tree5eb368aab714cd36e80b6b2e9615bf6851f5217e
parente1f8795f90215091c1c12c9b1568a52e510ca74a (diff)
[libc++][test] Propagate host environment to libc++ test suite
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 (cherry picked from commit 39d4e169d35b59a39ad2fcfe1a568ba979079d83)
-rw-r--r--libcxx/test/libcxx/selftest/dsl/dsl.sh.py1
-rw-r--r--libcxx/utils/libcxx/test/newconfig.py4
2 files changed, 5 insertions, 0 deletions
diff --git a/libcxx/test/libcxx/selftest/dsl/dsl.sh.py b/libcxx/test/libcxx/selftest/dsl/dsl.sh.py
index 6ffedad2523f..81fb60ac790f 100644
--- a/libcxx/test/libcxx/selftest/dsl/dsl.sh.py
+++ b/libcxx/test/libcxx/selftest/dsl/dsl.sh.py
@@ -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
diff --git a/libcxx/utils/libcxx/test/newconfig.py b/libcxx/utils/libcxx/test/newconfig.py
index 2ac5cf239d63..253f8e8e1394 100644
--- a/libcxx/utils/libcxx/test/newconfig.py
+++ b/libcxx/utils/libcxx/test/newconfig.py
@@ -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