Justify each coverage flag, and other cleanup
This commit is contained in:
parent
c0dcf67ec8
commit
0d2e3788ba
|
@ -16,20 +16,20 @@ _() {
|
||||||
: "${BUILDKITE_COMMIT:=local}"
|
: "${BUILDKITE_COMMIT:=local}"
|
||||||
reportName="lcov-${BUILDKITE_COMMIT:0:9}"
|
reportName="lcov-${BUILDKITE_COMMIT:0:9}"
|
||||||
|
|
||||||
export RUSTFLAGS="
|
coverageFlags=(-Zprofile) # Enable coverage
|
||||||
-Zprofile
|
coverageFlags+=("-Clink-dead-code") # Dead code should appear red in the report
|
||||||
-Zno-landing-pads
|
coverageFlags+=("-Ccodegen-units=1") # Disable ThinLTO which corrupts debuginfo (see [rustc issue #45511]).
|
||||||
-Ccodegen-units=1
|
coverageFlags+=("-Cinline-threshold=0") # Disable inlining, which complicates control flow.
|
||||||
-Cinline-threshold=0
|
coverageFlags+=("-Coverflow-checks=off") # Disable overflow checks, which create unnecessary branches.
|
||||||
-Coverflow-checks=off
|
|
||||||
"
|
export RUSTFLAGS="${coverageFlags[*]}"
|
||||||
export CARGO_INCREMENTAL=0
|
export CARGO_INCREMENTAL=0
|
||||||
export RUST_BACKTRACE=1
|
export RUST_BACKTRACE=1
|
||||||
|
|
||||||
echo "--- remove old coverage results"
|
echo "--- remove old coverage results"
|
||||||
|
|
||||||
if [[ -d target/cov ]]; then
|
if [[ -d target/cov ]]; then
|
||||||
find target/cov -name \*.gcda -print0 | xargs -0 rm -f
|
find target/cov -name \*.gcda -print0 | xargs -0 rm -f
|
||||||
|
find target/cov -name \*.gcno -print0 | xargs -0 rm -f
|
||||||
fi
|
fi
|
||||||
rm -rf target/cov/$reportName
|
rm -rf target/cov/$reportName
|
||||||
|
|
||||||
|
@ -38,10 +38,13 @@ _ cargo +nightly test --target-dir target/cov --lib --all
|
||||||
|
|
||||||
_ scripts/fetch-grcov.sh
|
_ scripts/fetch-grcov.sh
|
||||||
echo "--- grcov"
|
echo "--- grcov"
|
||||||
./grcov target/cov/debug/deps/ > target/cov/lcov_full.info
|
./grcov target/cov/debug/deps/ > target/cov/lcov-full.info
|
||||||
|
|
||||||
echo "--- filter_non_local_files_from_lcov"
|
echo "--- filter-non-local-files-from-lcov"
|
||||||
filter_non_local_files_from_lcov() {
|
# TODO: The grcov `-s` option could be used to replace this function once grcov
|
||||||
|
# doesn't panic on files with the same name in different directories of a
|
||||||
|
# repository
|
||||||
|
filter-non-local-files-from-lcov() {
|
||||||
declare skip=false
|
declare skip=false
|
||||||
while read -r line; do
|
while read -r line; do
|
||||||
if [[ $line =~ ^SF:/ ]]; then
|
if [[ $line =~ ^SF:/ ]]; then
|
||||||
|
@ -59,7 +62,7 @@ filter_non_local_files_from_lcov() {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
filter_non_local_files_from_lcov < target/cov/lcov_full.info > target/cov/lcov.info
|
filter-non-local-files-from-lcov < target/cov/lcov-full.info > target/cov/lcov.info
|
||||||
|
|
||||||
echo "--- html report"
|
echo "--- html report"
|
||||||
# ProTip: genhtml comes from |brew install lcov| or |apt-get install lcov|
|
# ProTip: genhtml comes from |brew install lcov| or |apt-get install lcov|
|
||||||
|
|
Loading…
Reference in New Issue