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

94f313133b80d9bd684fefee644a44621aed9066 contrib: add a script to generate coverage data for the daemon (Antoine Poinsot)

Pull request description:

  Taken and adapted from revaultd. Can be trivially adapted to the GUI.

ACKs for top commit:
  darosior:
    ACK 94f313133b80d9bd684fefee644a44621aed9066

Tree-SHA512: 1899526aa134f01d36ce624fad536a3794afb61ddbdd55a5688c0d9647405c3200354634a05348e8b801c174ddcdbaf3f98609ef07f3d360222ef808b649d012
This commit is contained in:
Antoine Poinsot 2022-12-06 13:22:33 +01:00
commit 35dc4abd00
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