add optional coverage on integration test
second attempt at #227 (closed)
to use, simply run setup/teardown with COVERAGE=1. This require grcov to make raw data into readable report. It can be installed with cargo install grcov
.
Result of a run with what the CI does currently (a single curl) is temporarily available here.
Alternatively, we could have a source-able script containing the following:
COVERAGE_BASEDIR=$(git rev-parse --show-toplevel)
export RUSTFLAGS="-Z instrument-coverage"
export LLVM_PROFILE_FILE=$COVERAGE_BASEDIR/coverage_meta/%p-%m.profraw
export RUSTUP_TOOLCHAIN=nightly
function generate_report() {
result=${1:-$COVERAGE_BASEDIR/coverage}
grcov "$COVERAGE_BASEDIR/coverage_meta" --binary-path "$COVERAGE_BASEDIR/target/debug/" \
-s "$COVERAGE_BASEDIR/crates/" -t html --branch --ignore-not-existing -o "$result"
}
Source this and anything you compile and run (tests, normat run/integration tests, but apparently not fuzzing with cargo-fuzz) generate coverage data
Edited by trinity-1686a