-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add documentation for using code coverage #14371
Add documentation for using code coverage #14371
Conversation
I recently played with this, and found it difficult to get a good overview of what is required and how the tooling actually works. This tries to document all of that, including what the coverage report actually looks like, and how to use it. I've also added a section on remote execution, because it is currently *especially* hard to use there, and while these are bugs it is still useful information for anyone who needs to get coverage to run at the moment, as well as language-specific documentation because I know that the implementation is a bit different for each, and at least Python requires a few hacks to get to work.
@lfpino has had a glance over this before, can't seem to request a review from him, so I'll just add him here. |
- A bazel binary that includes [b01c859][python_coverage_commit], | ||
which should be any Bazel >3.0. | ||
- A [modified version of coverage.py][modified_coveragepy]. | ||
<!-- TODO: Upstream an lcov implementation so that this becomes usable --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: could you file issues for these TODOs once you get the approval from the Bazel team?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, of course :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks fine; I just have one comment re. C++, but I don't think it's pressing if you don't feel you can answer it.
Includes notes for: * Using coverage with remote execution. * How the LCOV output can be used with genhtml to create HTML output. * How Python coverage can be achieved, albeit with some work. Closes bazelbuild#14371. PiperOrigin-RevId: 415362878
Hi, sorry for the out-of-the-blue PR, but we've been working on getting code coverage to run in remote execution downstream, and written up these docs.
The basic local workflow is fairly easy (though I think it's still useful to document how
genhtml
is intended to be used), but there are a handful of issues with remote execution. The doc as-is just lists and explains them, as well as workarounds, but we intend to fix at least some those problems over the coming weeks.The python workflow is also quite rough at the moment, we're looking at making this simpler (see nedbat/coveragepy#587).
Nonetheless, it would be nice to have some review on this in the mean time, so that we can get it merged a bit more quickly, and at least have code coverage documented a bit better even if it is broken in some ways.
I think I may not have been diligent enough with checking whether it builds, so apologies if this just ends up causing a build failure. I hope CI will help a little with this.