[clang] Generate empty .clang-format-ignore before running tests (PR #136154)
Devon Loehr via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 18 08:29:19 PDT 2025
https://github.com/DKLoehr updated https://github.com/llvm/llvm-project/pull/136154
>From 804fcdd84e8551005bfa5dae58d24f9852608360 Mon Sep 17 00:00:00 2001
From: Devon Loehr <dloehr at google.com>
Date: Thu, 17 Apr 2025 16:10:55 +0000
Subject: [PATCH 1/2] Generate empty .clang-format-ignore before running tests
---
clang/test/Format/lit.local.cfg | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/clang/test/Format/lit.local.cfg b/clang/test/Format/lit.local.cfg
index b060c79226cbd..cf79e8df89a33 100644
--- a/clang/test/Format/lit.local.cfg
+++ b/clang/test/Format/lit.local.cfg
@@ -1,3 +1,4 @@
+import os
import platform
import lit.formats
@@ -27,3 +28,8 @@ config.suffixes = [
# python implementation does, so use that for cross platform compatibility
if platform.system() == "AIX":
config.test_format = lit.formats.ShTest()
+
+# Create an empty .clang-format-ignore file so that tests don't get messed
+# up if one exists higher in the tree
+with open(os.path.join("Format", ".clang-format-ignore"), 'w'):
+ pass
\ No newline at end of file
>From 94d80cbb3b63c14f047fe253c5adf2ce26e4f554 Mon Sep 17 00:00:00 2001
From: Devon Loehr <DKLoehr at users.noreply.github.com>
Date: Thu, 17 Apr 2025 13:27:27 -0400
Subject: [PATCH 2/2] Just create file in cwd
Should be more robust to whether the Format folder already exists or not.
---
clang/test/Format/lit.local.cfg | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/clang/test/Format/lit.local.cfg b/clang/test/Format/lit.local.cfg
index cf79e8df89a33..20e217664997b 100644
--- a/clang/test/Format/lit.local.cfg
+++ b/clang/test/Format/lit.local.cfg
@@ -31,5 +31,5 @@ if platform.system() == "AIX":
# Create an empty .clang-format-ignore file so that tests don't get messed
# up if one exists higher in the tree
-with open(os.path.join("Format", ".clang-format-ignore"), 'w'):
- pass
\ No newline at end of file
+with open(".clang-format-ignore", 'w'):
+ pass
More information about the cfe-commits
mailing list