Skip to content
Snippets Groups Projects
Commit ef5dc3cb authored by Nick Mathewson's avatar Nick Mathewson :game_die:
Browse files

with_coverage: Allow toolchain selection.

There's some kind of bug in nightly that (for me) keeps grcov from
generating correct results. Instead, it misses some crates entirely.

No trouble, though: I can just use an older nightly until they get
this issue fixed!

This patch makes using a different version of nightly possible with
a new RUST_COVERAGE_TOOLCHAIN environment variable.
parent 9a77b23c
No related branches found
No related tags found
1 merge request!253with_coverage: Allow toolchain selection.
......@@ -56,9 +56,11 @@ if [ $# -eq 0 ] && [ $interactive = "no" ]; then
exit 1
fi
# Validate that +nightly is installed. This will log a message to stderr
echo "Using toolchain +${RUST_COVERAGE_TOOLCHAIN:=nightly}. (Override with \$RUST_COVERAGE_TOOLCHAIN)"
# Validate that "+${RUST_COVERAGE_TOOLCHAIN}" is installed. This will log a message to stderr
# if it isn't.
cargo +nightly -h >/dev/null
cargo "+${RUST_COVERAGE_TOOLCHAIN}" -h >/dev/null
# Validate that grcov is installed.
if [ "$(which grcov 2>/dev/null)" = "" ]; then
......@@ -67,15 +69,15 @@ if [ "$(which grcov 2>/dev/null)" = "" ]; then
fi
# Validate that llvm-tools-preview is installed.
if [ "$(rustup +nightly component list --installed | grep llvm-tools-preview)" = "" ]; then
echo "llvm-tools-preview appears not to be installed. Try 'rustup +nightly component add llvm-tools-preview'." >&2
if [ "$(rustup "+${RUST_COVERAGE_TOOLCHAIN}" component list --installed | grep llvm-tools-preview)" = "" ]; then
echo "llvm-tools-preview appears not to be installed. Try 'rustup +${RUST_COVERAGE_TOOLCHAIN} component add llvm-tools-preview'." >&2
exit 1
fi
COVERAGE_BASEDIR=$(git rev-parse --show-toplevel)
export RUSTFLAGS="-Z instrument-coverage"
export LLVM_PROFILE_FILE=$COVERAGE_BASEDIR/coverage_meta/%p-%m.profraw
export RUSTUP_TOOLCHAIN=nightly
export RUSTUP_TOOLCHAIN="${RUST_COVERAGE_TOOLCHAIN}"
if [ -d "$COVERAGE_BASEDIR/coverage" ]; then
rm -r "$COVERAGE_BASEDIR/coverage" || true
......@@ -92,7 +94,6 @@ if [ ! -e "$COVERAGE_BASEDIR/coverage_meta/commands" ] ; then
echo "REVISION: $(git rev-parse HEAD) $(git diff --quiet || echo "[dirty]")" > "$COVERAGE_BASEDIR/coverage_meta/commands"
fi
if [ $# -ne 0 ]; then
echo "$@" >> "$COVERAGE_BASEDIR/coverage_meta/commands"
"$@"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment