You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Have a general mechanism for collecting code coverage #5885
P3We're not considering working on this, but happy to review a PR. (No assignee)coveragenot staleIssues or PRs that are inactive but not considered staleteam-Rules-ServerIssues for serverside rules included with Bazeltype: feature request
Code coverage support in Bazel is poor and one reason is the lack of a general mechanism for collecting the code coverage information.
As briefly described in Bazel coverage design doc, the next steps towards a more general solution are:
Design and implement a coverage_toolchain
Migrate Bazel builtin C++ code coverage collection to use the new mechanism.
Reacted by Akshay Shah, Kent Ross, Chris Rice, Markus Padourek, Nathan Fisher, Mathieu Boespflug, Eric Klein, LaurieHarding-Russell, Robin Tweedie, Marco Heinemann and 3 more
@iirina I thought i'd post the instructions you left me here incase someone else is after a way to integrate with bazel coverage in the interm until this is better supported.
If the rules are written in Starlark, something helpful can be:
Bazel generates coverage reports in the lcov format. To work well with Bazel, your test rules also have to generate lcov reports under COVERAGE_DIR directory. Your test rule has to define the $lcov_merger attrbiute (similar to how Java tests do )
One thing that came up today - with this design of coverage collection is it possible to have another rule depend on the coverage output? We would like to write another rule that depends on the output and then creates a script that will upload the report on bazel run.
@iirina I'm taking another look at this but I havn't been able to figure out how to get COVERAGE_DIR defined.
This is this PR im working in and im running the test npx bazel coverage packages/jasmine/test:coverage_test but the only env var that's defined is LCOV_MERGER becasue I set it with coverage --test_env=LCOV_MERGER=/bin/truebazel-contrib/rules_nodejs#1135
Is there any update on this? We desperately need code coverage with non-lcov tools. Is there at least some workaround where you define your toolchain and keep the instrumentation files and instrumentation executions with arbitrary extensions (e.g. *.csmes, *.o.csmes and *.o.csexe in the case of Squish Coco?
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. If you think this issue is still relevant and should stay open, please post any comment here and the issue will no longer be marked as stale.
P3We're not considering working on this, but happy to review a PR. (No assignee)coveragenot staleIssues or PRs that are inactive but not considered staleteam-Rules-ServerIssues for serverside rules included with Bazeltype: feature request
Activity
Toxicable commentedon Mar 29, 2019
@iirina I thought i'd post the instructions you left me here incase someone else is after a way to integrate with
bazel coveragein the interm until this is better supported.If the rules are written in Starlark, something helpful can be:
Bazel generates coverage reports in the lcov format. To work well with Bazel, your test rules also have to generate lcov reports under COVERAGE_DIR directory. Your test rule has to define the $lcov_merger attrbiute (similar to how Java tests do )
bazel/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaTestRule.java
Line 70 in 17794d5
Globegitter commentedon May 16, 2019
One thing that came up today - with this design of coverage collection is it possible to have another rule depend on the coverage output? We would like to write another rule that depends on the output and then creates a script that will upload the report on
bazel run.Toxicable commentedon Feb 1, 2020
@iirina I'm taking another look at this but I havn't been able to figure out how to get
COVERAGE_DIRdefined.This is this PR im working in and im running the test
npx bazel coverage packages/jasmine/test:coverage_testbut the only env var that's defined is LCOV_MERGER becasue I set it withcoverage --test_env=LCOV_MERGER=/bin/truebazel-contrib/rules_nodejs#1135libratiger commentedon Jan 10, 2022
is there any update for this feature?
SoftwareApe commentedon Jan 25, 2023
Is there any update on this? We desperately need code coverage with non-lcov tools. Is there at least some workaround where you define your toolchain and keep the instrumentation files and instrumentation executions with arbitrary extensions (e.g.
*.csmes,*.o.csmesand*.o.csexein the case of Squish Coco?github-actions commentedon Mar 31, 2024
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. If you think this issue is still relevant and should stay open, please post any comment here and the issue will no longer be marked as stale.
SoftwareApe commentedon Mar 31, 2024
Not stale