Skip to content

Commit bb69419

Browse files
committed
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.
1 parent 20dd63c commit bb69419

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

contrib/test.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ fi
1616
cargo --version
1717
rustc --version
1818

19+
# Work out if we are using a nightly toolchain.
20+
NIGHTLY=false
21+
if cargo --version | grep nightly; then
22+
NIGHTLY=true
23+
fi
24+
1925
echo "********* Testing std *************"
2026
# Test without any features other than std first
2127
cargo test --verbose --no-default-features --features="std"
@@ -74,6 +80,16 @@ fi
7480
# Bench if told to
7581
if [ "$DO_BENCH" = true ]
7682
then
83+
if [ "NIGHTLY" = false ]
84+
then
85+
if [ -n "TOOLCHAIN" ]
86+
then
87+
echo "TOOLCHAIN is set to a non-nightly toolchain but DO_BENCH requires a nightly toolchain"
88+
else
89+
echo "DO_BENCH requires a nightly toolchain"
90+
fi
91+
exit 1
92+
fi
7793
cargo bench --features unstable
7894
fi
7995

0 commit comments

Comments
 (0)