-
Notifications
You must be signed in to change notification settings - Fork 1
/
generate_coverage.sh
executable file
·60 lines (52 loc) · 1.38 KB
/
generate_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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
export CARGO_INCREMENTAL=0
export RUSTFLAGS="-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort"
export RUSTDOCFLAGS="-Cpanic=abort"
select_nightly_rust() {
echo "> Selecting nightly rust";
rustup default nightly;
}
select_stable_rust() {
echo "> Selecting stable rust";
rustup default stable;
}
install_grcov() {
echo "> Installing grcov";
cargo install grcov;
}
cleanup_older_coverage() {
echo "> Cleaning old coverage";
rm -rf ./target/debug/coverage
}
build_project() {
echo "> Building project";
cargo build;
}
run_tests() {
echo "> Run tests";
cargo test --tests;
}
run_gcov() {
echo "> Running gcov";
# grcov . -s . --binary-path ./target/debug/ -t html --branch --ignore-not-existing --keep-only "src/prices/mod.rs" --keep-only "src/blockchain/mod.rs" --keep-only "src/lightning/mod.rs" --keep-only "tests/*" -o ./target/debug/coverage/;
grcov . \
--branch \
--ignore-not-existing \
--keep-only "src/prices/mod.rs" \
--keep-only "src/blockchain/mod.rs" \
--keep-only "src/lightning/mod.rs" \
--keep-only "tests/*" \
--binary-path ./target/debug/ \
-s . \
-t html \
-o ./target/debug/coverage/;
}
generate_coverage() {
select_nightly_rust
install_grcov
cleanup_older_coverage
build_project
run_tests
run_gcov
select_stable_rust
}
generate_coverage