[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:20:30 PST 2022


fanbo-meng updated this revision to Diff 405049.
fanbo-meng added a comment.

update comment


Repository:
  rG LLVM Github Monorepo

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

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-')
+        # z/OS linker does not support '_' in paths, so use '-' and letters.
+        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.405049.patch
Type: text/x-patch
Size: 1102 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220201/ffae39c1/attachment.bin>


More information about the llvm-commits mailing list