-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Description
The build.ninja file generated from a CMake invocation for clang-tools-extra generates the following lines among others for clang-tools-extra:
#############################################
# Utility command for check-clang-extra-clang-change-namespace
build tools/clang/tools/extra/test/check-clang-extra-clang-change-namespace: phony tools/clang/tools/extra/test/CMakeFiles/check-clang-extra-clang-change-namespace bin/FileCheck bin/clang-apply-replacements bin/clang-change-namespace bin/clang-doc bin/clang-include-fixer bin/clang-move bin/clang-query bin/clang-reorder-fields bin/clang-tidy bin/count bin/find-all-symbols bin/llvm-bcanalyzer bin/modularize bin/not bin/pp-trace bin/split-file lib/CTTestTidyModule.so tools/clang/lib/Headers/clang-resource-headers tools/clang/tools/extra/unittests/ExtraToolsUnitTests
#############################################
# Utility command for check-clang-extra-clang-doc
build tools/clang/tools/extra/test/check-clang-extra-clang-doc: phony tools/clang/tools/extra/test/CMakeFiles/check-clang-extra-clang-doc bin/FileCheck bin/clang-apply-replacements bin/clang-change-namespace bin/clang-doc bin/clang-include-fixer bin/clang-move bin/clang-query bin/clang-reorder-fields bin/clang-tidy bin/count bin/find-all-symbols bin/llvm-bcanalyzer bin/modularize bin/not bin/pp-trace bin/split-file lib/CTTestTidyModule.so tools/clang/lib/Headers/clang-resource-headers tools/clang/tools/extra/unittests/ExtraToolsUnitTests
As you can see, they're nearly identical save for the command name. The expected behavior for something like ninja -C build check-clang-tools-extra-clang-doc would be to only build clang-doc and its tests and to only run clang-doc tests. The actual result is that this builds and links every project in clang-tools-extra, but only runs the specified project's tests. That's unfortunate because it's time wasted building projects that aren't needed at the time.
I believe it might have something to do with the way that the project executables are added as test dependencies.
llvm-project/clang-tools-extra/test/CMakeLists.txt
Lines 83 to 86 in 56777e7
| add_lit_testsuite(check-clang-extra "Running clang-tools-extra/test" | |
| ${CMAKE_CURRENT_BINARY_DIR} | |
| DEPENDS ${CLANG_TOOLS_TEST_DEPS} | |
| ) |
where ${CLANG-TOOLS-TEST-DEPS} is
llvm-project/clang-tools-extra/test/CMakeLists.txt
Lines 31 to 54 in 9351ad6
| set(CLANG_TOOLS_TEST_DEPS | |
| # For the clang-doc tests that emit bitcode files. | |
| llvm-bcanalyzer | |
| # Individual tools we test. | |
| clang-apply-replacements | |
| clang-change-namespace | |
| clang-doc | |
| clang-include-fixer | |
| clang-move | |
| clang-query | |
| clang-reorder-fields | |
| find-all-symbols | |
| modularize | |
| pp-trace | |
| # Unit tests | |
| ExtraToolsUnitTests | |
| # clang-tidy tests require it. | |
| clang-resource-headers | |
| clang-tidy | |
| ) |
So it seems like all the executables are dependencies for every suite of tests.
I'm not familiar with how this might affect build bots or folks downstream. How disruptive would it be to divide these dependencies as needed?