-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcoverage.sh
executable file
·40 lines (33 loc) · 1.05 KB
/
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
#! /bin/bash
function cleanup() {
rm *.profraw *.profdata
}
trap cleanup EXIT
trap cleanup SIGINT
LLVM_PROFILE_FILE=".fr4-%m.profraw" \
RUSTFLAGS="-Zinstrument-coverage" cargo +nightly test
OBJECTS=$( \
for file in \
$( \
RUSTFLAGS="-Zinstrument-coverage" \
cargo +nightly test --tests --no-run --message-format=json \
| jq -r "select(.profile.test == true) | .filenames[]" \
| grep -v dSYM - \
); \
do \
printf "%s %s " -object $file; \
done \
)
echo "OBJECTS=$OBJECTS"
cargo profdata -- merge \
-sparse .fr4-*.profraw -o .fr4.profdata
cargo cov -- show \
$OBJECTS \
--instr-profile=.fr4.profdata \
--use-color \
--ignore-filename-regex='/.cargo/registry' \
--ignore-filename-regex='/target' \
--ignore-filename-regex='/rustc' \
--Xdemangler=rustfilt \
--format=html > /tmp/coverage.html \
&& open /tmp/coverage.html