Skip to content

Commit

Permalink
Check in CI that the crate builds on targets without libstd
Browse files Browse the repository at this point in the history
  • Loading branch information
Amanieu committed Aug 6, 2019
1 parent 167eb54 commit aecb361
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
24 changes: 15 additions & 9 deletions ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ci/tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ retry() {
"$@"
result=$?
[ $result -eq 0 ] && break
count=$(count + 1)
count=$((count + 1))
sleep 1
done

Expand Down

0 comments on commit aecb361

Please sign in to comment.