#!/usr/bin/env bash set -e; # Run a build with a given toolchain. TC=${TC?Supply a toolchain in this environment variable} echo "Rust toolchain: ${TC}" REPO_DIR=$( cd $(dirname ${BASH_SOURCE[0]})/..; pwd ) export CARGO_TARGET_DIR="${REPO_DIR}/target/build_local/${TC}" set -x; rustup self update; rustup toolchain update ${TC}; cd ${REPO_DIR}/framed; # use_std build cargo +${TC} test -p framed --verbose --lib; if [[ "${TC}" == "nightly" ]]; then # no_std build cargo +${TC} test -p framed --verbose --lib \ --no-default-features --features=use_nightly; # xargo arm build rustup component add rust-src --toolchain ${TC}; xargo_latest=$(curl https://crates.io/api/v1/crates/xargo \ | jq '.versions|sort_by(.created_at)|last|.num' -r); if cargo +${TC} install --list | egrep --no-messages --quiet "xargo v${xargo_latest}"; then echo "xargo version already latest." else cargo +${TC} install --verbose --force xargo; fi rustup run ${TC} xargo build --verbose --lib \ --target thumbv7em-none-eabihf \ --no-default-features --features=use_nightly; # doc tests require nightly cargo +${TC} test -p framed --verbose --doc \ --features=use_nightly; fi cargo +${TC} test -p framed --verbose --lib --features=trace; cargo +${TC} doc -p framed --verbose --no-deps; TC=${TC} ${REPO_DIR}/bin/decode_typed_test