File tree 2 files changed +39
-0
lines changed
2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ set -e
4
+
5
+ DESTDIR=" ${PWD} /target/cover"
6
+
7
+ rustup component add llvm-tools
8
+ cargo install grcov
9
+
10
+ export RUSTFLAGS=" -Cinstrument-coverage"
11
+ if [ " $( uname -o) " = " Darwin" ]; then
12
+ export RUSTFLAGS=" -Clink-arg=-Wl,-undefined,dynamic_lookup $RUSTFLAGS "
13
+ fi
14
+
15
+ export LLVM_PROFILE_FILE=" ${DESTDIR} /default_%m_%p.profraw"
16
+ cargo test
17
+
18
+ grcov " ${DESTDIR} " \
19
+ --ignore ' **/clang-sys*/**' \
20
+ --ignore " $HOME /.cargo/**" \
21
+ --ignore-not-existing \
22
+ --excl-start ' begin_impossible!' \
23
+ --excl-stop ' end_impossible!' \
24
+ --llvm \
25
+ --binary-path " target/debug/" \
26
+ -s . \
27
+ --branch \
28
+ -o " ${DESTDIR} " \
29
+ --output-types html,cobertura
30
+
31
+ xmllint --xpath " concat('Coverage: ', 100 * string(//coverage/@line-rate), '%')" " ${DESTDIR} /cobertura.xml"
32
+
33
+ if [ " $( uname -o) " = " Darwin" ] && [ -z " $CI " ]; then
34
+ open " ${DESTDIR} /html/index.html"
35
+ fi
Original file line number Diff line number Diff line change 9
9
.PHONY : lint # Lint the project
10
10
lint : .pre-commit-config.yaml
11
11
@pre-commit run --show-diff-on-failure --color=always --all-files
12
+
13
+ .PHONY : cover # Run cover tests and generate & open a report.
14
+ cover :
15
+ @./.ci/test-cover
You can’t perform that action at this time.
0 commit comments