From 94f313133b80d9bd684fefee644a44621aed9066 Mon Sep 17 00:00:00 2001 From: Antoine Poinsot Date: Mon, 28 Nov 2022 16:10:01 +0100 Subject: [PATCH] contrib: add a script to generate coverage data for the daemon --- contrib/coverage.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 contrib/coverage.sh diff --git a/contrib/coverage.sh b/contrib/coverage.sh new file mode 100755 index 00000000..534e983b --- /dev/null +++ b/contrib/coverage.sh @@ -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