forked from multiversx/mx-sdk-rs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtests-coverage.sh
executable file
·33 lines (30 loc) · 1.05 KB
/
tests-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
#!/bin/sh
RUSTFLAGS="-C instrument-coverage" \
cargo test --tests
PROFRAW_FILES=$(find . -name "default_*.profraw")
llvm-profdata merge -sparse $PROFRAW_FILES -o tests.profdata
find . -name "default_*.profraw" -delete
llvm-cov export \
$( \
for file in \
$( \
RUSTFLAGS="-C instrument-coverage" \
cargo test --tests --no-run --message-format=json \
| jq -r "select(.profile.test == true) | .filenames[]" \
| grep -v dSYM - \
); \
do \
printf "%s %s " -object $file; \
done \
) \
--ignore-filename-regex='/.cargo/registry' \
--ignore-filename-regex='rustc/' \
--ignore-filename-regex='meta/src' \
--ignore-filename-regex='wasm-adapter' \
--ignore-filename-regex='benchmarks/' \
--ignore-filename-regex='tests/' \
--ignore-filename-regex='tools/coverage-renderer/' \
--instr-profile=tests.profdata --summary-only --format=text > tests.coverage
rm ./tests.profdata
cargo run --quiet --bin coverage-renderer ./tests.coverage > coverage.md
rm ./tests.coverage