From 7e3d015be32e191050b11a94ba0479c20adb56ad Mon Sep 17 00:00:00 2001 From: RunasSudo Date: Mon, 28 Jun 2021 00:27:28 +1000 Subject: [PATCH] Fix incorrect calculation of code coverage --- coverage.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/coverage.sh b/coverage.sh index 7f7f850..d0dba13 100755 --- a/coverage.sh +++ b/coverage.sh @@ -10,8 +10,11 @@ cargo test 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" \ +# Need "eval" to correctly parse arguments +eval llvm-cov show target/coverage/debug/opentally -instr-profile=target/coverage/opentally.profdata -Xdemangler="$HOME/.cargo/bin/rustfilt" \ + $(for file in $(cargo test --no-run --message-format=json 2>/dev/null | jq -r "select(.profile.test == true) | .filenames[]"); do echo -n --object '"'$file'" '; done) \ -ignore-filename-regex="$HOME/." \ -ignore-filename-regex=numbers/rational_num.rs \ -ignore-filename-regex=stv/wasm.rs \ + -ignore-filename-regex=tests \ -format=html --show-instantiations=false --output-dir=target/coverage/html