bazel-contrib / bazel-contrib/toolchains_llvm

Document setting up code coverage

Open
#654 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Starlark
Stars
371
Forks
283
Avg merge
1d 55m
Merged PRs (30d)
25

Description

The [Bazel guidelines](https://bazel.build/configure/coverage) for computing code coverage are based on gcov.

When I wanted to compute code coverage based on LLVM and this toolchain I struggled finding proper guidance. After some experimentation and combining various answers from the web I ended up with:

```
coverage --combined_report=lcov
coverage --experimental_generate_llvm_lcov
coverage --action_env=BAZEL_USE_LLVM_NATIVE_COVERAGE=1
```

This works for me partly.

I say partly, because this still generates the data in the lcov format and I need to use a local `genthtml` to create a html report.

Ideally I would like to make use of `--experimental_use_llvm_covmap` and create the html report with `llvm-cov show`. To me the html generated by `llvm-cov` itself is much nicer, especially for branch coverage.

Since this project seems to be the most promising Bazel LLVM toolchain, I think it would be great if it would offer guidance how to compute code coverage based on LLVM and this toolchain specifically.

Contributor guide

Open the contributing guide

Research direction

Review the repository's existing documentation and Bazel coverage guidance first; the issue does not name a target file or test. Document the LLVM-based coverage workflow described in the issue, including how to produce an HTML report, and verify the instructions from a clean setup.

Written by the indexing model from the issue text.

Assessment

Domain
documentation, testing
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.