diff --git a/bin/build_local b/bin/build_local index 5e9d459..51641e5 100755 --- a/bin/build_local +++ b/bin/build_local @@ -3,24 +3,8 @@ set -ex; # A simple build script to run locally before pushing. -script_dir=$( cd $(dirname ${BASH_SOURCE[0]}); pwd ) -repo_dir=${script_dir}/.. +REPO_DIR=$( cd $(dirname ${BASH_SOURCE[0]})/..; pwd ) -cd ${repo_dir}; - -for tc in nightly stable beta; do - echo "Toolchain: ${tc}"; - rustup toolchain update ${tc}; - - export CARGO_TARGET_DIR="${repo_dir}/target/build_local/${tc}" - - cargo +${tc} test -p framed --verbose; - cargo +${tc} test -p framed --verbose --no-default-features; - cargo +${tc} test -p framed --verbose --no-default-features --features=typed; - cargo +${tc} test -p framed --verbose --features=trace; - cargo +${tc} doc -p framed --verbose --no-deps; +for TC in nightly stable beta; do + TC="${TC}" ${REPO_DIR}/bin/build_tc done - -DECODE_TYPE_CRATE_DIR=test_type \ - DECODE_TYPE_NAME=framed_test_type::Test \ - bin/decode_typed < /dev/null; diff --git a/bin/build_tc b/bin/build_tc new file mode 100755 index 0000000..c3d3d31 --- /dev/null +++ b/bin/build_tc @@ -0,0 +1,37 @@ +#!/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 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; + + # 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; + +# TODO: Use correct toolchain. +DECODE_TYPE_CRATE_DIR=${REPO_DIR}/test_type \ + DECODE_TYPE_NAME=framed_test_type::Test \ + ${REPO_DIR}/bin/decode_typed < /dev/null; diff --git a/bin/travis/script b/bin/travis/script index bb03b7c..7bc472a 100755 --- a/bin/travis/script +++ b/bin/travis/script @@ -1,21 +1,6 @@ #!/usr/bin/env bash set -e; -script_dir=$( cd $(dirname ${BASH_SOURCE[0]}); pwd ) -repo_dir=${script_dir}/../.. +REPO_DIR=$( cd $(dirname ${BASH_SOURCE[0]})/../..; pwd ) -echo "TRAVIS_RUST_VERSION: '${TRAVIS_RUST_VERSION}'" - -set -x; - -cd ${repo_dir}; - -cargo test -p framed --verbose; -cargo test -p framed --verbose --no-default-features; -cargo test -p framed --verbose --no-default-features --features=typed; -cargo test -p framed --verbose --features=trace; -cargo doc -p framed --verbose --no-deps; - -DECODE_TYPE_CRATE_DIR=test_type \ - DECODE_TYPE_NAME=framed_test_type::Test \ - bin/decode_typed < /dev/null; +TC="${TRAVIS_RUST_VERSION}" ${REPO_DIR}/bin/build_tc