add support for single-crate coverage to help iterate, update to latest grcov (#4085)

* add support for single-crate coverage to help iterate, update to latest grcov

* shellcheck

* fixup

* remove unused

* install grcov before setting RUSTFLAGS ;)

* rely on nightly having grcov installed
This commit is contained in:
Rob Walker 2019-05-01 23:33:28 -07:00 committed by GitHub
parent 7f75cc8906
commit 379d2e6d95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 20 deletions

View File

@ -12,6 +12,12 @@ source ci/_
: "${BUILDKITE_COMMIT:=local}"
reportName="lcov-${BUILDKITE_COMMIT:0:9}"
if [[ -n $1 ]]; then
crate=--manifest-path=$1
else
crate=--all
fi
coverageFlags=(-Zprofile) # Enable coverage
coverageFlags+=("-Clink-dead-code") # Dead code should appear red in the report
coverageFlags+=("-Ccodegen-units=1") # Disable ThinLTO which corrupts debuginfo (see [rustc issue #45511]).
@ -29,12 +35,12 @@ fi
rm -rf target/cov/$reportName
source ci/rust-version.sh nightly
_ cargo +$rust_nightly build --target-dir target/cov --all
_ cargo +$rust_nightly test --target-dir target/cov --lib --all -- --test-threads=1
_ cargo +$rust_nightly build --target-dir target/cov "$crate"
_ cargo +$rust_nightly test --target-dir target/cov --lib "$crate" -- --test-threads=1
_ scripts/fetch-grcov.sh
echo "--- grcov"
./grcov target/cov/debug/deps/ > target/cov/lcov-full.info
_ grcov target/cov/debug/deps/ > target/cov/lcov-full.info
echo "--- filter-files-from-lcov"

View File

@ -1,16 +0,0 @@
#!/usr/bin/env bash
set -e
if [[ ! -x ./grcov ]]; then
uname=$(uname | tr '[:upper:]' '[:lower:]')
if [[ $uname = darwin ]]; then
uname="osx"
fi
uname_m=$(uname -m | tr '[:upper:]' '[:lower:]')
name=grcov-${uname}-${uname_m}.tar.bz2
wget "https://github.com/mozilla/grcov/releases/download/v0.3.2/$name"
tar xjf "$name"
fi
ls -lh grcov