[PATCH] D118723: [SystemZ][z/OS]: Manually create lit tmp_dir
Fanbo Meng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 1 12:16:26 PST 2022
fanbo-meng created this revision.
Herald added a subscriber: delcypher.
fanbo-meng requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Follow up of https://reviews.llvm.org/D118071. tempfile.mkdtemp() can still potentially include '_' character in the generated name, so we need to manually create lit temp directory name for z/OS to ensure it does not contain '_' character.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D118723
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
@@ -244,9 +244,17 @@
# the buildbot level.
tmp_dir = None
if 'LIT_PRESERVES_TMP' not in os.environ:
- import tempfile
# z/OS linker does not support '_' in paths, so use '-'.
- tmp_dir = tempfile.mkdtemp(prefix='lit-tmp-')
+ if sys.platform == 'zos':
+ import random
+ import string
+ while True:
+ tmp_dir = '/tmp/lit-tmp-' + ''.join(random.choice(string.ascii_letters) for i in range(8))
+ if not os.path.exists(tmp_dir): break
+ os.makedirs(tmp_dir, mode=700)
+ else:
+ import tempfile
+ 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}:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118723.405046.patch
Type: text/x-patch
Size: 1024 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220201/e921246f/attachment.bin>
More information about the llvm-commits
mailing list