Collect code coverage.

v0.7.x
whitequark 2017-11-19 09:34:30 +00:00
parent a66f2dcd24
commit ca8c5b4daf
3 changed files with 23 additions and 0 deletions

2
.gitignore vendored
View File

@ -1,2 +1,4 @@
target
Cargo.lock
*.gcno
*.gcda

View File

@ -17,3 +17,7 @@ alloc = []
default = ["std"]
# Unstable features
map = []
[profile.test]
opt-level = 1
codegen-units = 1

17
coverage.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash -e
cargo rustc -- --test -C link-dead-code -Z profile -Z no-landing-pads
LCOVOPTS=(
--gcov-tool llvm-gcov
--rc lcov_branch_coverage=1
--rc lcov_excl_line=assert
)
lcov "${LCOVOPTS[@]}" --capture --directory . --base-directory . \
-o target/coverage/raw.lcov
lcov "${LCOVOPTS[@]}" --extract target/coverage/raw.lcov "$(pwd)/*" \
-o target/coverage/raw_crate.lcov
genhtml --branch-coverage --demangle-cpp --legend \
-o target/coverage/ \
target/coverage/raw_crate.lcov