-
Notifications
You must be signed in to change notification settings - Fork 4
/
coverage.sh
executable file
·35 lines (28 loc) · 825 Bytes
/
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
#!/bin/bash
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
set -e
#set -x
export RUSTFLAGS="-Cinstrument-coverage"
export LLVM_PROFILE_FILE="coverage/profiles/scrut-%p-%m.profraw"
# cleanup & init
[ -d coverage ] && rm -rf coverage
mkdir -p coverage/profiles
# create binary
cargo build --verbose
# run tests to create coverage
cargo test --all-features --verbose -- --include-ignored
# render coverage
grcov . --binary-path ./target/debug/ \
-s . \
-t html \
--branch \
--ignore-not-existing \
--ignore "/*" \
-o ./coverage/output/
echo "Output: file:https://$(pwd)/coverage/output/index.html"
if [ $(uname) == "Darwin" ]; then
open coverage/output/index.html
fi