[clang] [clang][lit] mkdir before mkstemp in is_filesystem_case_insensitive() (PR #131036)

Arthur Eubanks via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 13 10:18:59 PDT 2025


https://github.com/aeubanks updated https://github.com/llvm/llvm-project/pull/131036

>From 6ab707eec90cbe1d8a8f5ddf19765f514b275095 Mon Sep 17 00:00:00 2001
From: Arthur Eubanks <aeubanks at google.com>
Date: Wed, 12 Mar 2025 21:42:47 +0000
Subject: [PATCH 1/2] [clang][lit] mkdir before mkstemp in
 is_filesystem_case_insensitive()

In the CMake build test_exec_root already exists here, but not in the gn build, which causes this to fail.
---
 clang/test/lit.cfg.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/clang/test/lit.cfg.py b/clang/test/lit.cfg.py
index 9820ddd1f14af..074167fa6cad3 100644
--- a/clang/test/lit.cfg.py
+++ b/clang/test/lit.cfg.py
@@ -253,6 +253,7 @@ def have_host_clang_repl_cuda():
 
 
 def is_filesystem_case_insensitive():
+    os.mkdir(config.test_exec_root)
     handle, path = tempfile.mkstemp(prefix="case-test", dir=config.test_exec_root)
     isInsensitive = os.path.exists(
         os.path.join(os.path.dirname(path), os.path.basename(path).upper())

>From c7152e09377cb710a25adcd93325d453ec90c49b Mon Sep 17 00:00:00 2001
From: Arthur Eubanks <aeubanks at google.com>
Date: Thu, 13 Mar 2025 17:18:32 +0000
Subject: [PATCH 2/2] makedirs(exist_ok=True)

---
 clang/test/lit.cfg.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/test/lit.cfg.py b/clang/test/lit.cfg.py
index 074167fa6cad3..e04d85b5f8282 100644
--- a/clang/test/lit.cfg.py
+++ b/clang/test/lit.cfg.py
@@ -253,7 +253,7 @@ def have_host_clang_repl_cuda():
 
 
 def is_filesystem_case_insensitive():
-    os.mkdir(config.test_exec_root)
+    os.makedirs(config.test_exec_root, exist_ok=True)
     handle, path = tempfile.mkstemp(prefix="case-test", dir=config.test_exec_root)
     isInsensitive = os.path.exists(
         os.path.join(os.path.dirname(path), os.path.basename(path).upper())



More information about the cfe-commits mailing list