From f9d47533eee849a4919fe753d28634686cd45a9e Mon Sep 17 00:00:00 2001 From: RunasSudo Date: Mon, 14 Jun 2021 14:43:08 +1000 Subject: [PATCH] Use llvm-cov for coverage reporting grcov reports incorrect coverage, e.g. showing blank lines as uncovered --- coverage.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/coverage.sh b/coverage.sh index bf11a9a..7f7f850 100755 --- a/coverage.sh +++ b/coverage.sh @@ -8,7 +8,10 @@ export LLVM_PROFILE_FILE="target/coverage/prof/opentally-%p-%m.profraw" export CARGO_TARGET_DIR=target/coverage cargo test -grcov target/coverage/prof --binary-path target/coverage/debug -t html -o target/coverage/html \ - --ignore src/numbers/rational_num.rs \ - --ignore src/stv/wasm.rs \ - --ignore 'tests/*' +llvm-profdata merge -sparse target/coverage/prof/*.profraw -o target/coverage/opentally.profdata + +llvm-cov show target/coverage/debug/opentally -instr-profile=target/coverage/opentally.profdata -Xdemangler="$HOME/.cargo/bin/rustfilt" \ + -ignore-filename-regex="$HOME/." \ + -ignore-filename-regex=numbers/rational_num.rs \ + -ignore-filename-regex=stv/wasm.rs \ + -format=html --show-instantiations=false --output-dir=target/coverage/html