• edror12 1 Hey there, I’m new here and I’m working on this [#181554]( [clangd] Guard against null TemplateName in DumpVisitor by edror12 · Pull Request #181554 · llvm/llvm-project · GitHub ) the reviewer asked for a test, I wrote one based on the other tests in the file, but I have no idea how to run that single test. • Any help is appreciated. • test file: clang-tools-extra/clangd/unittests/DumpASTTests.cpp Judging by the PR being closed you figured it out in the end, glad to see that. • For anyone reading this in future, these files get built into GoogleTest binaries that are usually run via ninja check- -unit target. • Not sure the exact one in this case. • Or, as the author figured out, you can run the binary directly and use filters to pick tests to run: ➜ build git:(main) ✗ ./tools/clang/tools/extra/clangd/unittests/ClangdTests –gtest_filter=‘DumpASTTests.NestedTemplates’ Just make sure you ninja after you’ve made changes, so that the binary is rebuilt.

Article Summaries:

  • A contributor to the LLVM project asked how to execute a single unit test for clangd after adding a new test in DumpASTTests.cpp. The issue referenced PR #181554, which was closed once the solution was found. The answer clarified that clangd tests are compiled into GoogleTest binaries typically run with ninja check-unit. For targeted execution, one can run the built binary directly and filter tests with the --gtest_filter flag, e.g., ./tools/clang/tools/extra/clangd/unittests/ClangdTests --gtest_filter='DumpASTTests.NestedTemplates'. It also reminded developers to rebuild the binary with ninja after changes.

Sources: