Skip to content

Conversation

@DKLoehr
Copy link
Contributor

@DKLoehr DKLoehr commented Apr 17, 2025

Followup to #136022, this ensures formatting tests are run with an empty .clang-format-ignore in their root directory, to prevent failures if the file also exists higher in the tree.

@llvmbot
Copy link
Member

llvmbot commented Apr 17, 2025

@llvm/pr-subscribers-clang-format

Author: Devon Loehr (DKLoehr)

Changes

Followup to #136022, this ensures formatting tests are run with an empty .clang-format-ignore in their root directory, to prevent failures if the file also exists higher in the tree.


Full diff: https://github.com/llvm/llvm-project/pull/136154.diff

1 Files Affected:

  • (modified) clang/test/Format/lit.local.cfg (+6)
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

Should be more robust to whether the Format folder already exists or not.
@aeubanks
Copy link
Contributor

ah yes, the build directory can be outside of the source directory, lgtm. still good to keep the other PR though so outside .clang-format-ignore files don't leak into clang-format used inside llvm-project

@aeubanks aeubanks merged commit 915de1a into llvm:main Apr 18, 2025
6 of 11 checks passed
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
Followup to llvm#136022, this ensures formatting tests are run with an empty
`.clang-format-ignore` in their root directory, to prevent failures if
the file also exists higher in the tree.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants