Skip to content
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

Closed

Conversation

TLATER
Copy link

@TLATER TLATER commented Dec 3, 2021

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.

TLATER and others added 2 commits December 2, 2021 14:49
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.
@TLATER
Copy link
Author

TLATER commented Dec 3, 2021

@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 -->
Copy link
Contributor

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?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, of course :)

@oquenchil oquenchil added the team-Rules-Server Issues for serverside rules included with Bazel label Dec 7, 2021
Copy link
Member

@c-mita c-mita left a 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.

site/docs/coverage.md Show resolved Hide resolved
@bazel-io bazel-io closed this in 8c3e486 Dec 9, 2021
Bencodes pushed a commit to Bencodes/bazel that referenced this pull request Jan 10, 2022
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes team-Rules-Server Issues for serverside rules included with Bazel
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants