contrib: add a script to generate coverage data for the daemon

This commit is contained in:
Antoine Poinsot 2022-11-28 16:10:01 +01:00
parent ad8a034ed0
commit 94f313133b
No known key found for this signature in database
GPG Key ID: E13FC145CD3F4304

21
contrib/coverage.sh Executable file
View File

@ -0,0 +1,21 @@
# Assumes you have functional tests dependencies installed (likely you are in a venv)
set -ex
if [ -z "$JOBS" ]; then JOBS=1; fi
if ! command -v grcov &>/dev/null; then
cargo install grcov
fi
cargo clean
rm -f "lianad_coverage_*.profraw"
LLVM_PROFILE_FILE="lianad_coverage_%m.profraw" RUSTFLAGS="-Zinstrument-coverage" RUSTDOCFLAGS="$RUSTFLAGS -Z unstable-options --persist-doctests target/debug/doctestbins" cargo +nightly build --all-features
LLVM_PROFILE_FILE="lianad_coverage_%m.profraw" RUSTFLAGS="-Zinstrument-coverage" RUSTDOCFLAGS="$RUSTFLAGS -Z unstable-options --persist-doctests target/debug/doctestbins" cargo +nightly test --all-features
pytest -n $JOBS
grcov . --source-dir ./src/ --binary-path ./target/debug/ -t html --branch --ignore-not-existing --llvm -o ./target/grcov/
firefox target/grcov/index.html
set +ex