[llvm] 0f6f628 - [lit] Make sure our test temp directory is actually used by tests
Julian Lettner via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 13 11:23:36 PST 2022
Author: Julian Lettner
Date: 2022-01-13T11:23:32-08:00
New Revision: 0f6f6284d733f44c9a1186a949b845c40b272ca6
URL: https://github.com/llvm/llvm-project/commit/0f6f6284d733f44c9a1186a949b845c40b272ca6
DIFF: https://github.com/llvm/llvm-project/commit/0f6f6284d733f44c9a1186a949b845c40b272ca6.diff
LOG: [lit] Make sure our test temp directory is actually used by tests
All credit to Martin Storsjö (mstorsjo) who describes the issue here:
https://github.com/llvm/llvm-project/issues/53167
Differential Revision: https://reviews.llvm.org/D117179
Added:
Modified:
llvm/utils/lit/lit/main.py
Removed:
################################################################################
diff --git a/llvm/utils/lit/lit/main.py b/llvm/utils/lit/lit/main.py
index 73747360601a5..99777eef8ec02 100755
--- a/llvm/utils/lit/lit/main.py
+++ b/llvm/utils/lit/lit/main.py
@@ -245,13 +245,11 @@ def execute_in_tmp_dir(run, lit_config):
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:
More information about the llvm-commits
mailing list