bazelbuild / bazelbuild/bazel

Make coverage possible with use of cc_common.compile

Open
#15,974 6 comments 2 reactions 0 assignees View on GitHub
coverage not stale P4 team-Rules-CPP type: feature request
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

### Description of the feature request:

For custom C/C++ rules that compile using `cc_common.compile` it is impossible to generate coverage since there is no way to get the generated `gcno` files. If `gcno` files are exposed in `CcCompilationOutputs` then it makes generating coverage for these rules possible. Currently I am using a forked version of [Bazel](https://github.com/SibrosTech/bazel) with the changes found in this [PR](https://github.com/bazelbuild/bazel/pull/12129) and this allows us to successfully generate coverage reports for code compiled with `cc_common.compile` and remote execution enabled.

### What underlying problem are you trying to solve with this feature?

In some cases where rules need to compile with `cc_common.compile` we still want to be able to collect code coverage. Without this we would have to search through the `bazel-out` after the `bazel coverage ...` command runs which also would not work with remote execution.

### Have you found anything relevant by searching the web?

https://github.com/bazelbuild/bazel/pull/12129

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the referenced PR 12129 and the cc_common.compile and CcCompilationOutputs APIs. Trace how generated gcno files are handled for coverage, including remote execution. Done means custom C/C++ rules using cc_common.compile can expose the gcno files and generate coverage without searching bazel-out.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.