Add informative error message to DO_BENCH

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.
This commit is contained in:
Tobin C. Harding 2022-07-14 09:53:31 +10:00
parent c6d5a12b60
commit f60c92ca58
1 changed files with 16 additions and 0 deletions

View File

@ -16,6 +16,12 @@ fi
cargo --version cargo --version
rustc --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 *************" echo "********* Testing std *************"
# Test without any features other than std first # Test without any features other than std first
cargo test --verbose --no-default-features --features="std" cargo test --verbose --no-default-features --features="std"
@ -74,6 +80,16 @@ fi
# Bench if told to # Bench if told to
if [ "$DO_BENCH" = true ] if [ "$DO_BENCH" = true ]
then 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 cargo bench --features unstable
fi fi