Add a cargo option to generate coverage reports using -Z instrument-coverage
#85902
Labels
A-code-coverage
Area: Source-based code coverage (-Cinstrument-coverage)
C-feature-request
Category: A feature request, i.e: not implemented / a PR.
T-cargo
Relevant to the cargo team, which will review and decide on the PR/issue.
The Rust unstable book includes some examples of the workflow for generating LLVM coverage reports using
-Z instrument-coverage
.Given the flexibility of this feature, having these detailed examples is useful, but there should be an "easy button" for generating coverage reports for the more common use cases. (I have some personal bash scripts to simplify the process during development, for example.)
cargo
can provide a great foundation for cross platform automation of Rust coverage analysis.Some loose requirements, off the top of my head, include:
cargo run
andcargo test
options. (Enabling the coverage report workflow will, therefore, probably be a flag option to these commands, versus a separate command, I think.)LLVM_PROFILE_FILE
, with the right filename patterns for filename deconfliction, and a path to a coverage-specific subdirectory of the target directory.profraw
,profdata
, and report data, before starting another coverage analysis (unless the user provides a flag option to retain old data).--persist-doctests
, and the workflow should automatically include the right test binaries when running thellvm-cov
command).llvm-cov
options in thecargo
command.llvm-cov
option configuration that generates a coverage report with minimalcargo
flags, and perhaps a few easy flags for other common configurations (for example, generating results as text, with ANSI terminal color highlights or not, or generating HTML, with files saved in the coverage target subdirectory with associatedprofraw
/profdata
files).cargo
Longer term:
profraw
data from multiple executions (being careful not to automatically delete data from prior runs when the user requests this feature).The text was updated successfully, but these errors were encountered: