Open a9zerwer opened 1 year ago
Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 90 days unless any other activity occurs or one of the following labels is added: "not stale", "awaiting-bazeler". Please reach out to the triage team (@bazelbuild/triage
) if you think this issue is still relevant or you are interested in getting the issue resolved.
Still happening. https://github.com/bazelbuild/bazel/pull/12129 would fix this for GCOV, but appears to be stalled.
As a workaround (for llvm-cov, not gcov), you can create a special text file ending in runtime_objects_list.txt
that contains the execution path for binaries/shared libraries and pass that to coverage_common.instrumented_files_info
in its metadata_files
argument (available with Bazel 7). Then collect_cc_coverage.sh
will parse the file and call llvm-cov
with the right arguments (assuming you also apply the workaround in https://github.com/bazelbuild/bazel/issues/14970#issuecomment-1894565761, at least on macOS). See https://github.com/phst/rules_elisp/blob/1fbdfd49e7687edff710e72177c62e2ccf503391/elisp/defs.bzl#L463-L477 for an example.
Random suggestion: Create a function cc_common.instrumented_files_info
that takes toolchain, feature config, compilation and linking outputs, etc. as arguments and creates an InstrumentedFilesInfo
provider with the right metadata files.
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 generatedgcno
files. Ifgcno
files are exposed inCcCompilationOutputs
then it makes generating coverage for these rules possible. Currently I am using a forked version of Bazel with the changes found in this PR and this allows us to successfully generate coverage reports for code compiled withcc_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 thebazel-out
after thebazel 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