Skip to content

Commit 3825ab8

Browse files
committed
build: add script for test coverage
1 parent 924b162 commit 3825ab8

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
# https://blog.rng0.io/how-to-do-code-coverage-in-rust
6+
CARGO_INCREMENTAL=0 RUSTFLAGS='-Cinstrument-coverage' LLVM_PROFILE_FILE='cargo-test-%p-%m.profraw' cargo test
7+
8+
rm -rf target/coverage
9+
mkdir -p target/coverage
10+
11+
grcov . --binary-path ./target/debug/deps/ -s . -t html --branch --ignore-not-existing --ignore '../*' --ignore "/*" -o target/coverage/html
12+
13+
grcov . --binary-path ./target/debug/deps/ -s . -t lcov --branch --ignore-not-existing --ignore '../*' --ignore "/*" -o target/coverage/lcov.info
14+
15+
rm *.profraw

0 commit comments

Comments
 (0)