Skip to content

Latest commit

 

History

History
24 lines (17 loc) · 1.23 KB

GRCOV.md

File metadata and controls

24 lines (17 loc) · 1.23 KB

Getting test coverage report with grcov

Get grcov and install their requirements for your system.

To get a complete test report run the following commands with these env variables set. (I found some flags they suggested broke with some of our packages.)

.bashrc

export LLVM_PROFILE_FILE="your_name-%p-%m.profraw"
export RUSTDOCFLAGS="-Cpanic=abort"
  1. RUSTFLAGS="-Zinstrument-coverage -Ccodegen-units=1 -Copt-level=0 -Coverflow-checks=off -Zpanic_abort_tests" CARGO_INCREMENTAL=0 RUSTC_BOOTSTRAP=1 cargo build
  2. RUSTFLAGS="-Zinstrument-coverage -Ccodegen-units=1 -Copt-level=0 -Coverflow-checks=off -Zpanic_abort_tests" CARGO_INCREMENTAL=0 RUSTC_BOOTSTRAP=1 cargo test
  3. grcov . -s . --binary-path ./target/debug/ -t html --branch --ignore-not-existing -o ./target/debug/coverage/

Known issues

  • If you run grcov on Windows you will need to run it as admin or it will fail with an error related to symlinks. Issue 561
  • [ERROR] Execution count overflow detected. can occur when running grcov but is not fatal and a report will still be created. Issue 613