[clang] fe3f6c6 - [Clang] Propagate 'SystemDrive' environment variable for unit tests (#90478)

via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 29 10:21:31 PDT 2024


Author: Krystian Stasiowski
Date: 2024-04-29T13:21:27-04:00
New Revision: fe3f6c63cd6b75433a72b980a23d9848d19abdc2

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

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

Added: 
    

Modified: 
    clang/test/Unit/lit.cfg.py

Removed: 
    


################################################################################
diff  --git a/clang/test/Unit/lit.cfg.py b/clang/test/Unit/lit.cfg.py
index 475069e630d74e..37e91d0f8629f9 100644
--- a/clang/test/Unit/lit.cfg.py
+++ b/clang/test/Unit/lit.cfg.py
@@ -25,13 +25,9 @@
 
 # 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 [


        


More information about the cfe-commits mailing list