llvm / llvm/llvm-project

Every clang-tools-extra project is a dependency for each test suite.

Open
#165,820 1 comment 0 reactions 0 assignees View on GitHub
clang-tools-extra cmake
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

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.

https://github.com/llvm/llvm-project/blob/56777e7da2cb30f72a3ddc9861a2fbe3b9adbc6b/clang-tools-extra/test/CMakeLists.txt#L83-L86

where `${CLANG-TOOLS-TEST-DEPS}` is

https://github.com/llvm/llvm-project/blob/9351ad638be5f5cb2f7de300f0518f5ff0923fbf/clang-tools-extra/test/CMakeLists.txt#L31-L54

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?

Contributor guide

Open the contributing guide

Research direction

Start with clang-tools-extra/test/CMakeLists.txt, especially the test dependency definitions around the cited lines, and compare them with the generated build.ninja entries for the check-clang-extra suites. Trace how CLANG-TOOLS-TEST-DEPS is applied to each suite. Done means a suite such as check-clang-tools-extra-clang-doc builds only clang-doc and its tests while preserving the expected test execution.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake
Domain
build-system, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.