Skip to content

Ship llvm-cov and llvm-profdata with coverage_files - #856

Open
AustinSchuh wants to merge 2 commits into
bazelbuild:mainfrom
AustinSchuh:coverage-files
Open

Ship llvm-cov and llvm-profdata with coverage_files#856
AustinSchuh wants to merge 2 commits into
bazelbuild:mainfrom
AustinSchuh:coverage-files

Conversation

@AustinSchuh

Copy link
Copy Markdown
Contributor

The rule-based cc_toolchain's coverage_files group was empty (a TODO: action_names.bzl lists no actions for coverage), so a toolchain whose llvm_cov / llvm_profdata tools are files -- a hermetic LLVM distribution -- cannot collect llvm-format coverage: the environment points collect_cc_coverage.sh at the right execroot-relative llvm-profdata path, but the binary is not among the coverage test action's inputs, and collection fails with

.../bin/llvm-profdata: No such file or directory

The legacy cc_toolchain never hit this because its coverage_files attribute defaults to all_files. Toolchains whose coverage tools are absolute paths (xcrun shims, /usr/bin/gcov) are unaffected either way.

Verified with toolchains_llvm's darwin toolchain: with this change, bazel coverage --experimental_use_llvm_covmap --experimental_generate_llvm_lcov produces a populated lcov report where it previously failed outright.

The rule-based cc_toolchain's coverage_files group was empty (a TODO:
action_names.bzl lists no actions for coverage), so a toolchain whose
llvm_cov / llvm_profdata tools are files -- a hermetic LLVM
distribution -- cannot collect llvm-format coverage: the environment
points collect_cc_coverage.sh at the right execroot-relative
llvm-profdata path, but the binary is not among the coverage test
action's inputs, and collection fails with

  .../bin/llvm-profdata: No such file or directory

The legacy cc_toolchain never hit this because its coverage_files
attribute defaults to all_files. Toolchains whose coverage tools are
absolute paths (xcrun shims, /usr/bin/gcov) are unaffected either way.

Verified with toolchains_llvm's darwin toolchain: with this change,
`bazel coverage --experimental_use_llvm_covmap
--experimental_generate_llvm_lcov` produces a populated lcov report
where it previously failed outright.

Signed-off-by: Austin Schuh <austin.linux@gmail.com>
Comment thread cc/toolchains/legacy_file_group.bzl
Same reasoning as llvm-cov and llvm-profdata: a toolchain whose gcov
tool is a file rather than an absolute path needs it among the
coverage test action's inputs.

Signed-off-by: Austin Schuh <austin.linux@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants