diff options
Diffstat (limited to 'ci/script.sh')
| -rw-r--r-- | ci/script.sh | 210 |
1 files changed, 132 insertions, 78 deletions
diff --git a/ci/script.sh b/ci/script.sh index 7cda1e5..6c09909 100644 --- a/ci/script.sh +++ b/ci/script.sh @@ -33,137 +33,191 @@ arm_example() { main() { local T=$TARGET - local nightly="" - - if [ $TRAVIS_RUST_VERSION = nightly ]; then - nightly="nightly" - fi mkdir -p ci/builds - if [ $T = x86_64-unknown-linux-gnu ]; then - # compile-fail and compile-pass tests - case $TRAVIS_RUST_VERSION in - nightly*) - # TODO how to run a subset of these tests when timer-queue is disabled? - cargo test --features "$nightly,timer-queue" --test compiletest --target $T - esac + # Current MSRV cannot handle profiles, remove compilation optimisations + if [[ $TRAVIS_RUST_VERSION == 1.*.* ]]; then + echo "Removing optimisation profiles" + sed -i '/^\[profile.*build-override]$/,/^$/{/^#/!{/^$/!d}}' Cargo.toml + fi - cargo check --target $T - if [ $TARGET != thumbv6m-none-eabi ]; then - cargo check --features "$nightly,timer-queue" --target $T + if [ $T = x86_64-unknown-linux-gnu ]; then + if [[ $TRAVIS_RUST_VERSION == 1.*.* ]]; then + # test on a fixed version (MSRV) to avoid problems with changes in rustc diagnostics + # compile-fail tests + cargo test --test single --target $T fi - if [ $TRAVIS_RUST_VERSION != nightly ]; then - rm -f .cargo/config - if [ $TARGET != thumbv6m-none-eabi ]; then - cargo doc --features timer-queue - else + if [ $TRAVIS_RUST_VERSION = nightly ]; then + # Tests where required MSRV > 1.36 + #local exs=( + #) + #for ex in ${exs[@]}; do + # cargo check --example $ex --target $T + #done + + # multi-core compile-pass tests + pushd heterogeneous + local exs=( + smallest + x-init-2 + x-init + x-schedule + x-spawn + ) + for ex in ${exs[@]}; do + cargo microamp --example $ex --target thumbv7m-none-eabi,thumbv6m-none-eabi --check + done + + popd + + else + if [ $TRAVIS_RUST_VERSION != nightly ]; then + rm -f .cargo/config cargo doc + ( cd book/en && mdbook build ) + ( cd book/ru && mdbook build ) + + local td=$(mktemp -d) + cp -r target/doc $td/api + mkdir $td/book + cp -r book/en/book $td/book/en + cp -r book/ru/book $td/book/ru + cp LICENSE-* $td/book/en + cp LICENSE-* $td/book/ru + + linkchecker $td/book/en/ + linkchecker $td/book/ru/ + linkchecker $td/api/rtic/ + linkchecker $td/api/cortex_m_rtic_macros/ fi - ( cd book/en && mdbook build ) - ( cd book/ru && mdbook build ) - - local td=$(mktemp -d) - cp -r target/doc $td/api - mkdir $td/book - cp -r book/en/book $td/book/en - cp -r book/ru/book $td/book/ru - cp LICENSE-* $td/book/en - cp LICENSE-* $td/book/ru - - linkchecker $td/book/en/ - linkchecker $td/book/ru/ - linkchecker $td/api/rtfm/ - linkchecker $td/api/cortex_m_rtfm_macros/ fi + cargo check --target $T + ( cd macros && cargo test --target $T ) + return fi - cargo check --features "$nightly" --target $T --examples - if [ $TARGET != thumbv6m-none-eabi ]; then - cargo check --features "$nightly,timer-queue" --target $T --examples + if [ $TARGET = thumbv6m-none-eabi ]; then + cargo check --target $T --examples + + # Check examples with specific features not compatible with MSRV + if [[ $TRAVIS_RUST_VERSION != 1.*.* ]]; then + cargo check --target $T --examples --features __min_r1_43 + fi + else + cargo check --target $T --examples --features __v7 + + # Check examples with specific features not compatible with MSRV + if [[ $TRAVIS_RUST_VERSION != 1.*.* ]]; then + cargo check --target $T --examples --features __v7,__min_r1_43 + fi fi + cargo check -p homogeneous --target $T --examples + # run-pass tests case $T in thumbv6m-none-eabi | thumbv7m-none-eabi) local exs=( idle init - interrupt + hardware + preempt binds resource lock late - static + only-shared-access task message capacity - singleton - types not-send not-sync + shared-with-init generics + cfg + pool ramfunc ) for ex in ${exs[@]}; do - if [ $ex = ramfunc ] && [ $T = thumbv6m-none-eabi ]; then - # LLD doesn't support this at the moment + if [ $ex = pool ]; then + if [ $TARGET = thumbv6m-none-eabi ]; then + continue + fi + + local td=$(mktemp -d) + + cargo run --example $ex --target $TARGET --features __v7 >\ + $td/pool.run + grep 'foo(0x2' $td/pool.run + grep 'bar(0x2' $td/pool.run + arm-none-eabi-objcopy -O ihex target/$TARGET/debug/examples/$ex \ + ci/builds/${ex}___v7_debug_1.hex + + cargo run --example $ex --target $TARGET --features __v7 --release >\ + $td/pool.run + grep 'foo(0x2' $td/pool.run + grep 'bar(0x2' $td/pool.run + arm-none-eabi-objcopy -O ihex target/$TARGET/release/examples/$ex \ + ci/builds/${ex}___v7_release_1.hex + + rm -rf $td + continue fi - if [ $ex != types ]; then - arm_example "run" $ex "debug" "$nightly" "1" - arm_example "run" $ex "release" "$nightly" "1" + if [ $ex = types ]; then + if [ $TARGET = thumbv6m-none-eabi ]; then + continue + fi + + arm_example "run" $ex "debug" "__v7" "1" + arm_example "run" $ex "release" "__v7" "1" + + continue fi - if [ $TARGET != thumbv6m-none-eabi ]; then - arm_example "run" $ex "debug" "$nightly,timer-queue" "1" - arm_example "run" $ex "release" "$nightly,timer-queue" "1" + arm_example "run" $ex "debug" "" "1" + if [ $ex = types ]; then + arm_example "run" $ex "release" "" "1" + else + arm_example "build" $ex "release" "" "1" fi done local built=() cargo clean for ex in ${exs[@]}; do - if [ $ex = ramfunc ] && [ $T = thumbv6m-none-eabi ]; then - # LLD doesn't support this at the moment - continue - fi - - if [ $ex = singleton ]; then - # singleton build is currently not reproducible due to - # https://github.com/japaric/owned-singleton/issues/2 - continue + if [ $ex = types ] || [ $ex = pool ]; then + if [ $TARGET = thumbv6m-none-eabi ]; then + continue + fi + + arm_example "build" $ex "debug" "__v7" "2" + cmp ci/builds/${ex}___v7_debug_1.hex \ + ci/builds/${ex}___v7_debug_2.hex + arm_example "build" $ex "release" "__v7" "2" + cmp ci/builds/${ex}___v7_release_1.hex \ + ci/builds/${ex}___v7_release_2.hex + else + arm_example "build" $ex "debug" "" "2" + cmp ci/builds/${ex}_debug_1.hex \ + ci/builds/${ex}_debug_2.hex + arm_example "build" $ex "release" "" "2" + cmp ci/builds/${ex}_release_1.hex \ + ci/builds/${ex}_release_2.hex fi - if [ $ex != types ]; then - arm_example "build" $ex "debug" "$nightly" "2" - cmp ci/builds/${ex}_${nightly/nightly/nightly_}debug_1.hex \ - ci/builds/${ex}_${nightly/nightly/nightly_}debug_2.hex - arm_example "build" $ex "release" "$nightly" "2" - cmp ci/builds/${ex}_${nightly/nightly/nightly_}release_1.hex \ - ci/builds/${ex}_${nightly/nightly/nightly_}release_2.hex - - built+=( $ex ) - fi - - if [ $TARGET != thumbv6m-none-eabi ]; then - arm_example "build" $ex "debug" "$nightly,timer-queue" "2" - cmp ci/builds/${ex}_${nightly}_timer-queue_debug_1.hex \ - ci/builds/${ex}_${nightly}_timer-queue_debug_2.hex - arm_example "build" $ex "release" "$nightly,timer-queue" "2" - cmp ci/builds/${ex}_${nightly}_timer-queue_release_1.hex \ - ci/builds/${ex}_${nightly}_timer-queue_release_2.hex - fi + built+=( $ex ) done ( cd target/$TARGET/release/examples/ && size ${built[@]} ) |
