Skip to content

Commit

Permalink
Add informative error message to DO_BENCH
Browse files Browse the repository at this point in the history
If CI script is run with `DO_BENCH=true` and `TOOLCHAIN` set to a
non-nightly toolchain the build will fail with a less than meaningful
error. To assist runners of the script output an informative error
message if an attempt is made at using the wrong toolchain.
  • Loading branch information
tcharding committed Jul 13, 2022
1 parent c6d5a12 commit f60c92c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions contrib/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ fi
cargo --version
rustc --version

# Work out if we are using a nightly toolchain.
NIGHTLY=false
if cargo --version | grep nightly; then
NIGHTLY=true
fi

echo "********* Testing std *************"
# Test without any features other than std first
cargo test --verbose --no-default-features --features="std"
Expand Down Expand Up @@ -74,6 +80,16 @@ fi
# Bench if told to
if [ "$DO_BENCH" = true ]
then
if [ "NIGHTLY" = false ]
then
if [ -n "TOOLCHAIN" ]
then
echo "TOOLCHAIN is set to a non-nightly toolchain but DO_BENCH requires a nightly toolchain"
else
echo "DO_BENCH requires a nightly toolchain"
fi
exit 1
fi
cargo bench --features unstable
fi

Expand Down

0 comments on commit f60c92c

Please sign in to comment.