aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKrystian Stasiowski <sdkrystian@gmail.com>2024-04-29 13:21:27 -0400
committerGitHub <noreply@github.com>2024-04-29 13:21:27 -0400
commitfe3f6c63cd6b75433a72b980a23d9848d19abdc2 (patch)
treee9500c13da60062e232400b967048a78e8e01741
parentf9d4d54aa0cb6fbeee1e8744b379b1eac59c3afc (diff)
downloadllvm-fe3f6c63cd6b75433a72b980a23d9848d19abdc2.zip
llvm-fe3f6c63cd6b75433a72b980a23d9848d19abdc2.tar.gz
llvm-fe3f6c63cd6b75433a72b980a23d9848d19abdc2.tar.bz2
[Clang] Propagate 'SystemDrive' environment variable for unit tests (#90478)
On Windows, running unit tests by directly invoking `llvm-lit.py` (e.g. `python3 llvm-lit.py clang/test/Unit`) may create a folder named `%SystemDrive%` in the current working directory. This appears to happen because `lit.cfg.py` in `clang/test/Unit` does not propagate the `SystemDrive` environment variable.
-rw-r--r--clang/test/Unit/lit.cfg.py10
1 files changed, 3 insertions, 7 deletions
diff --git a/clang/test/Unit/lit.cfg.py b/clang/test/Unit/lit.cfg.py
index 475069e..37e91d0 100644
--- a/clang/test/Unit/lit.cfg.py
+++ b/clang/test/Unit/lit.cfg.py
@@ -25,13 +25,9 @@ config.test_format = lit.formats.GoogleTest(config.llvm_build_mode, "Tests")
# Propagate the temp directory. Windows requires this because it uses \Windows\
# if none of these are present.
-if "TMP" in os.environ:
- config.environment["TMP"] = os.environ["TMP"]
-if "TEMP" in os.environ:
- config.environment["TEMP"] = os.environ["TEMP"]
-
-if "HOME" in os.environ:
- config.environment["HOME"] = os.environ["HOME"]
+for v in ["TMP", "TEMP", "HOME", "SystemDrive"]:
+ if v in os.environ:
+ config.environment[v] = os.environ[v]
# Propagate sanitizer options.
for var in [