-
Notifications
You must be signed in to change notification settings - Fork 0
/
coverage.sh
executable file
·38 lines (29 loc) · 1.05 KB
/
coverage.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env bash
###############################################################################
# Dependencies:
#
# $ sudo dnf install lcov
# $ rustup component add llvm-tools-preview
# $ cargo install grcov
#
###############################################################################
WORKING_DIRECTORY=$(pwd)
# clean before proceeding
cargo clean
# set instrumenting variables
export CARGO_INCREMENTAL=0
export RUSTDOCFLAGS="-Cpanic=abort"
export RUSTFLAGS="-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort"
# run all tests
cargo test
# prepare output directories for coverage results
mkdir ./target/lcov
mkdir ./target/coverage
# generate coverage info
grcov . --llvm -s . -t lcov --branch --ignore-not-existing --ignore "*cargo*" --ignore "*tests*" -o ./target/lcov/lcov.info
# generate coverage report
genhtml -t "dfpl" -q -o ./target/coverage ./target/lcov/lcov.info
# display final message
echo ""
echo "open coverage report: file://$WORKING_DIRECTORY/target/coverage/index.html"
echo ""