[PATCH] D117179: [lit] Make sure our test temp directory is actually used by tests

Julian Lettner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 13 11:23:47 PST 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG0f6f6284d733: [lit] Make sure our test temp directory is actually used by tests (authored by yln).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117179/new/

https://reviews.llvm.org/D117179

Files:
  llvm/utils/lit/lit/main.py


Index: llvm/utils/lit/lit/main.py
===================================================================
--- llvm/utils/lit/lit/main.py
+++ llvm/utils/lit/lit/main.py
@@ -245,13 +245,11 @@
     tmp_dir = None
     if 'LIT_PRESERVES_TMP' not in os.environ:
         import tempfile
-        tmp_dir = tempfile.mkdtemp(prefix="lit_tmp_")
-        os.environ.update({
-                'TMPDIR': tmp_dir,
-                'TMP': tmp_dir,
-                'TEMP': tmp_dir,
-                'TEMPDIR': tmp_dir,
-                })
+        tmp_dir = tempfile.mkdtemp(prefix='lit_tmp_')
+        tmp_dir_envs = {k: tmp_dir for k in ['TMP', 'TMPDIR', 'TEMP', 'TEMPDIR']}
+        os.environ.update(tmp_dir_envs)
+        for cfg in {t.config for t in run.tests}:
+            cfg.environment.update(tmp_dir_envs)
     try:
         run.execute()
     finally:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117179.399736.patch
Type: text/x-patch
Size: 849 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220113/64fb6276/attachment.bin>


More information about the llvm-commits mailing list