Add a script to run kcov

This commit is contained in:
mcarton 2016-10-02 15:12:12 +02:00
parent 7b92fe0387
commit 12c2d6a8d0
No known key found for this signature in database
GPG Key ID: 5E427C794CBA45E8

47
util/cov.sh Executable file
View File

@ -0,0 +1,47 @@
#!/usr/bin/bash
# This run `kcov` on Clippy. The coverage report will be at
# `./target/cov/index.html`.
# `compile-test` is special. `kcov` does not work directly on it so these files
# are compiled manually.
tests=(
camel_case
cc_seme
consts
dogfood
issue_825
matches
trim_multiline
used_underscore_binding_macro
versioncheck
)
tmpdir=$(mktemp -d)
cargo test --no-run --verbose
for t in "${tests[@]}"; do
kcov \
--verify \
--include-path="$(pwd)/src","$(pwd)/clippy_lints/src" \
"$tmpdir/$t" \
cargo test --test "$t"
done
for t in ./tests/compile-fail/*.rs; do
kcov \
--verify \
--include-path="$(pwd)/src","$(pwd)/clippy_lints/src" \
"$tmpdir/compile-fail-$(basename $t)" \
cargo run -- -L target/debug -L target/debug/deps -Z no-trans "$t"
done
for t in ./tests/run-pass/*.rs; do
kcov \
--verify \
--include-path="$(pwd)/src","$(pwd)/clippy_lints/src" \
"$tmpdir/run-pass-$(basename $t)" \
cargo run -- -L target/debug -L target/debug/deps -Z no-trans "$t"
done
kcov --verify --merge target/cov "$tmpdir"/*