2021-06-12 15:37:41 +10:00
|
|
|
#!/bin/bash
|
|
|
|
mkdir -p target/coverage/prof
|
|
|
|
rm target/coverage/prof/*.profraw
|
|
|
|
|
|
|
|
export RUSTC=./rustc_bs.sh
|
|
|
|
export RUSTFLAGS="-Zinstrument-coverage -Copt-level=0 -Clink-dead-code"
|
|
|
|
export LLVM_PROFILE_FILE="target/coverage/prof/opentally-%p-%m.profraw"
|
|
|
|
export CARGO_TARGET_DIR=target/coverage
|
|
|
|
cargo test
|
|
|
|
|
2021-06-14 14:43:08 +10:00
|
|
|
llvm-profdata merge -sparse target/coverage/prof/*.profraw -o target/coverage/opentally.profdata
|
2021-09-14 02:23:51 +10:00
|
|
|
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 > target/coverage/objects
|
2021-06-14 14:43:08 +10:00
|
|
|
|
2021-06-28 00:27:28 +10:00
|
|
|
# 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" \
|
2021-09-14 02:23:51 +10:00
|
|
|
$(cat target/coverage/objects) \
|
2021-06-14 14:43:08 +10:00
|
|
|
-ignore-filename-regex="$HOME/." \
|
2021-09-03 23:53:15 +10:00
|
|
|
-ignore-filename-regex=rustc \
|
2021-06-14 14:43:08 +10:00
|
|
|
-ignore-filename-regex=numbers/rational_num.rs \
|
2021-09-13 03:43:17 +10:00
|
|
|
-ignore-filename-regex=stv/gregory/prettytable_html.rs \
|
2021-06-14 14:43:08 +10:00
|
|
|
-ignore-filename-regex=stv/wasm.rs \
|
2021-06-28 00:27:28 +10:00
|
|
|
-ignore-filename-regex=tests \
|
2021-06-14 14:43:08 +10:00
|
|
|
-format=html --show-instantiations=false --output-dir=target/coverage/html
|