Skip to content

Commit 3de2bf7

Browse files
author
Mingshen Sun
committed
CI: fix coverage script for libmesabox refactor
1 parent e5f8f17 commit 3de2bf7

File tree

3 files changed

+34
-8
lines changed

3 files changed

+34
-8
lines changed

ci/libmesabox-cov-rustc

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash -e
2+
3+
get_crate_name()
4+
{
5+
while [[ $# -gt 1 ]] ; do
6+
v=$1
7+
case $v in
8+
--crate-name)
9+
echo $2
10+
return
11+
;;
12+
esac
13+
shift
14+
done
15+
}
16+
17+
case $(get_crate_name "$@") in
18+
libmesabox)
19+
EXTRA=$COVERAGE_OPTIONS
20+
;;
21+
*)
22+
;;
23+
esac
24+
25+
exec "$@" $EXTRA
File renamed without changes.

ci/run-cov

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
for path in /usr/lib/llvm-3.8/lib/clang/3.8.[0-9]/lib/linux/; do LLVM_PATH=$path; done
44
export COVERAGE_OPTIONS="-Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Cpasses=insert-gcov-profiling -Zno-landing-pads -L$LLVM_PATH -lclang_rt.profile-x86_64"
5-
export RUSTC_WRAPPER="./ci/cov-rustc"
65
export CARGO_INCREMENTAL=0
76

87
LCOVOPT="--gcov-tool ./ci/llvm-gcov --rc lcov_branch_coverage=1 --rc lcov_excl_line=assert"
@@ -12,25 +11,27 @@ LCOV="/usr/local/bin/lcov"
1211
rm -rf *.info *.gcda *.gcno
1312
cargo clean
1413

15-
# unit tests
16-
cargo rustc --all-features --profile test --lib
17-
rm ./target/debug/mesabox-*.d
18-
./target/debug/mesabox-*
19-
${LCOV} ${LCOVOPT} --capture --directory . --base-directory . -o mesabox.info
14+
# unit tests of libmesabox
15+
export RUSTC_WRAPPER="./ci/libmesabox-cov-rustc"
16+
cargo rustc --package libmesabox --all-features --profile test --lib
17+
rm ./target/debug/libmesabox-*.d
18+
./target/debug/libmesabox-*
19+
${LCOV} ${LCOVOPT} --capture --directory . --base-directory . -o libmesabox.info
2020

2121
# cleanup target
2222
rm -rf *.gcda *.gcno
2323
cargo clean
2424

2525
# integration tests
26+
export RUSTC_WRAPPER="./ci/mesabox-cov-rustc"
2627
cargo rustc --all-features --test tests
2728
rm ./target/debug/tests-*.d
2829
./target/debug/tests-*
2930
${LCOV} ${LCOVOPT} --capture --directory . --base-directory . -o tests.info
3031

3132
# combining and filtering
32-
${LCOV} ${LCOVOPT} --add mesabox.info --add tests.info -o coverage.info
33-
${LCOV} ${LCOVOPT} --extract coverage.info `find "$(cd src; pwd)" -name "*.rs"` -o final.info
33+
${LCOV} ${LCOVOPT} --add libmesabox.info --add tests.info -o coverage.info
34+
${LCOV} ${LCOVOPT} --extract coverage.info `find "$(cd src; pwd)" -name "*.rs"` `find "$(cd libmesabox; pwd)" -name "*.rs"` -o final.info
3435

3536
# generate report if not in CI
3637
if [[ "$CI" != true ]]; then

0 commit comments

Comments
 (0)