- 
                Notifications
    
You must be signed in to change notification settings  - Fork 15.1k
 
[NFC][clangd][test] add clang-tidy config to ensure test cases sandbox #141410
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[NFC][clangd][test] add clang-tidy config to ensure test cases sandbox #141410
Conversation
Under previous test setup, the test result will be influenced by clang-tidy file in parent folder (between llvm-projects root and build folder). It is inconventient and leads some confusion. This PR wants to ensure sandbox to avoid outside's clang-tidy influenece test result.
| 
          
 @llvm/pr-subscribers-clangd @llvm/pr-subscribers-clang-tools-extra Author: Congcong Cai (HerrCai0907) ChangesUnder previous test setup, the test result will be influenced by clang-tidy file in parent folder (between llvm-projects root and build folder). It is inconventient and leads some confusion. Full diff: https://github.com/llvm/llvm-project/pull/141410.diff 2 Files Affected: 
 diff --git a/clang-tools-extra/clangd/test/Inputs/path-mappings/server/.clang-tidy b/clang-tools-extra/clangd/test/Inputs/path-mappings/server/.clang-tidy
new file mode 100644
index 0000000000000..1f16f2a33b3ce
--- /dev/null
+++ b/clang-tools-extra/clangd/test/Inputs/path-mappings/server/.clang-tidy
@@ -0,0 +1 @@
+InheritParentConfig: false
\ No newline at end of file
diff --git a/clang-tools-extra/clangd/test/system-include-extractor.test b/clang-tools-extra/clangd/test/system-include-extractor.test
index 4ccc093671324..372b4a1a0fef5 100644
--- a/clang-tools-extra/clangd/test/system-include-extractor.test
+++ b/clang-tools-extra/clangd/test/system-include-extractor.test
@@ -32,6 +32,9 @@
 # RUN: echo 'printf "End of search list.\r\n" >&2' >> %t.dir/bin/my_driver.sh
 # RUN: chmod +x %t.dir/bin/my_driver.sh
 
+# Create fake clang-tidy config to ensure sandbox
+# RUN: echo 'InheritParentConfig: false' >> %t.dir/.clang-tidy
+
 # Create header files my/dir/a.h and my/dir2/b.h
 # RUN: mkdir -p %t.dir/my/dir
 # RUN: touch %t.dir/my/dir/a.h
 | 
    
| # RUN: chmod +x %t.dir/bin/my_driver.sh | ||
| 
               | 
          ||
| # Create fake clang-tidy config to ensure sandbox | ||
| # RUN: echo 'InheritParentConfig: false' >> %t.dir/.clang-tidy | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of this can you just pass -clang-tidy=0 to clangd invocations in this file? we shouldn't be testing/relying on any clang-tidy behavior in this test file.
| @@ -0,0 +1 @@ | |||
| InheritParentConfig: false No newline at end of file | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are we running any tests in this directory? these inputs are usually copied to temp test directories, since you're not copying this over in any of the tests, is this really needed? (or do we have some tests that recursively copy everything?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
path-mapping will copy all folder to tmp folder. but i agree disable clangtidy is better
Under previous test setup, the test result will be influenced by clang-tidy file in parent folder (between llvm-projects root and build folder). It is inconventient and leads some confusion.
This PR wants to ensure sandbox to avoid outside's clang-tidy influenece test result.