From aecb3612a1aee00d51e9767956e3927321388318 Mon Sep 17 00:00:00 2001 From: Amanieu d'Antras Date: Mon, 5 Aug 2019 08:49:30 +0200 Subject: [PATCH] Check in CI that the crate builds on targets without libstd --- .travis.yml | 4 ++++ ci/run.sh | 24 +++++++++++++++--------- ci/tools.sh | 2 +- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 752afba38c..50bae262d9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -62,6 +62,10 @@ matrix: - name: "aarch64-unknown-linux-gnu" env: TARGET=aarch64-unknown-linux-gnu CROSS=1 + # Ensure that we successfully build without libstd + - name: "thumbv6m-none-eabi" + env: TARGET=thumbv6m-none-eabi CROSS=1 NO_STD=1 + install: travis_retry rustup target add "${TARGET}" script: sh ci/run.sh diff --git a/ci/run.sh b/ci/run.sh index bb52d43272..613373613a 100644 --- a/ci/run.sh +++ b/ci/run.sh @@ -4,7 +4,14 @@ set -ex : "${TARGET?The TARGET environment variable must be set.}" -FEATURES="rayon,serde,rustc-internal-api" +if [ "${NO_STD}" = "1" ]; then + # Unfortunately serde currently doesn't work without std due to a cargo bug. + FEATURES="rustc-internal-api" + OP="build" +else + FEATURES="rustc-internal-api,serde,rayon" + OP="test" +fi if [ "${TRAVIS_RUST_VERSION}" = "nightly" ]; then FEATURES="${FEATURES},nightly" export RUSTFLAGS="$RUSTFLAGS -D warnings" @@ -19,18 +26,17 @@ if [ "${CROSS}" = "1" ]; then CARGO=cross fi -export RUSTFLAGS="$RUSTFLAGS --cfg hashbrown_deny_warnings" - # Make sure we can compile without the default hasher -"${CARGO}" -vv check --target="${TARGET}" --no-default-features +"${CARGO}" -vv build --target="${TARGET}" --no-default-features +"${CARGO}" -vv build --target="${TARGET}" --release --no-default-features -"${CARGO}" -vv test --target="${TARGET}" -"${CARGO}" -vv test --target="${TARGET}" --features "${FEATURES}" +"${CARGO}" -vv ${OP} --target="${TARGET}" +"${CARGO}" -vv ${OP} --target="${TARGET}" --features "${FEATURES}" -"${CARGO}" -vv test --target="${TARGET}" --release -"${CARGO}" -vv test --target="${TARGET}" --release --features "${FEATURES}" +"${CARGO}" -vv ${OP} --target="${TARGET}" --release +"${CARGO}" -vv ${OP} --target="${TARGET}" --release --features "${FEATURES}" -if [ "${TRAVIS_RUST_VERSION}" = "nightly" ]; then +if [ "${TRAVIS_RUST_VERSION}" = "nightly" ] && [ "${NO_STD}" != 1 ]; then # Run benchmark on native targets, build them on non-native ones: NO_RUN="" if [ "${CROSS}" = "1" ]; then diff --git a/ci/tools.sh b/ci/tools.sh index fe2ba52f08..c6b014ca3b 100644 --- a/ci/tools.sh +++ b/ci/tools.sh @@ -13,7 +13,7 @@ retry() { "$@" result=$? [ $result -eq 0 ] && break - count=$(count + 1) + count=$((count + 1)) sleep 1 done