Collect code coverage.
This commit is contained in:
parent
a66f2dcd24
commit
ca8c5b4daf
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +1,4 @@
|
||||
target
|
||||
Cargo.lock
|
||||
*.gcno
|
||||
*.gcda
|
||||
|
@ -17,3 +17,7 @@ alloc = []
|
||||
default = ["std"]
|
||||
# Unstable features
|
||||
map = []
|
||||
|
||||
[profile.test]
|
||||
opt-level = 1
|
||||
codegen-units = 1
|
||||
|
17
coverage.sh
Executable file
17
coverage.sh
Executable 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
|
Loading…
Reference in New Issue
Block a user