-
Notifications
You must be signed in to change notification settings - Fork 16
Coverage
Niklas Dewally edited this page Feb 11, 2024
·
8 revisions
-
Run coverage with
./tools/coverage.sh
. -
Open this in a web-browser by opening
target/debug/coverage/index.html
. -
An
lcov
file is generated attarget/debug/lcov.info
for in-editor coverage.- If you use VSCode, configuration for this should be provided when you clone the repo. Click the "watch" button in the status bar to view coverage for a file.
See the code for full details: tools/coverage.sh.
A high level overview is:
- The project is built and tested using instrumentation based coverage.
- Grcov is used to aggregate these reports into
lcov.info
andhtml
formats. - The
lcov.info
file can be used with thelcov
command to generate summaries and get coverage information. This is used to make the summaries in our PR coverage comments.
Reading:
- grcov readme - how to generate coverage reports.
- rustc book - details on instrumentation based coverage.
Text: This prints a doc coverage table for all crates in the repo:
RUSTDOCFLAGS='-Z unstable-options --show-coverage' cargo +nightly doc --workspace --no-deps
JSON: Although we don't use it yet, we can get doc coverage information as JSON. This will be useful for prettier and more useful output:
RUSTDOCFLAGS='-Z unstable-options --show-coverage --output-format json' cargo +nightly doc --workspace --no-deps
Reading
See the unstable options section of the rustdoc book. Link.
The contents of this repository are licensed under the Mozilla Public Licence.