]> git.lizzy.rs Git - rust.git/blob - util/cov.sh
Auto merge of #5293 - matthiaskrgr:macro_skip_lifetime, r=phansch
[rust.git] / util / cov.sh
1 #!/usr/bin/bash
2
3 # This run `kcov` on Clippy. The coverage report will be at
4 # `./target/cov/index.html`.
5 # `compile-test` is special. `kcov` does not work directly on it so these files
6 # are compiled manually.
7
8 tests=$(find tests/ -maxdepth 1 -name '*.rs' ! -name compile-test.rs -exec basename {} .rs \;)
9 tmpdir=$(mktemp -d)
10
11 cargo test --no-run --verbose
12
13 for t in $tests; do
14   kcov \
15     --verify \
16     --include-path="$(pwd)/src,$(pwd)/clippy_lints/src" \
17     "$tmpdir/$t" \
18     cargo test --test "$t"
19 done
20
21 for t in ./tests/compile-fail/*.rs; do
22   kcov \
23     --verify \
24     --include-path="$(pwd)/src,$(pwd)/clippy_lints/src" \
25     "$tmpdir/compile-fail-$(basename "$t")" \
26     cargo run -- -L target/debug -L target/debug/deps -Z no-trans "$t"
27 done
28
29 for t in ./tests/run-pass/*.rs; do
30   kcov \
31     --verify \
32     --include-path="$(pwd)/src,$(pwd)/clippy_lints/src" \
33     "$tmpdir/run-pass-$(basename "$t")" \
34     cargo run -- -L target/debug -L target/debug/deps -Z no-trans "$t"
35 done
36
37 kcov --verify --merge target/cov "$tmpdir"/*