2017-07-27 22:02:25 +02:00
|
|
|
set -euxo pipefail
|
2017-04-12 06:12:06 +02:00
|
|
|
|
2019-01-16 08:21:40 +01:00
|
|
|
arm_example() {
|
|
|
|
local COMMAND=$1
|
|
|
|
local EXAMPLE=$2
|
|
|
|
local BUILD_MODE=$3
|
|
|
|
local FEATURES=$4
|
|
|
|
local BUILD_NUM=$5
|
|
|
|
|
|
|
|
if [ $BUILD_MODE = "release" ]; then
|
|
|
|
local RELEASE_FLAG="--release"
|
|
|
|
else
|
|
|
|
local RELEASE_FLAG=""
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -n "$FEATURES" ]; then
|
|
|
|
local FEATURES_FLAG="--features $FEATURES"
|
|
|
|
local FEATURES_STR=${FEATURES/,/_}_
|
|
|
|
else
|
|
|
|
local FEATURES_FLAG=""
|
|
|
|
local FEATURES_STR=""
|
|
|
|
fi
|
|
|
|
local CARGO_FLAGS="--example $EXAMPLE --target $TARGET $RELEASE_FLAG $FEATURES_FLAG"
|
|
|
|
|
|
|
|
if [ $COMMAND = "run" ]; then
|
|
|
|
cargo $COMMAND $CARGO_FLAGS | diff -u ci/expected/$EXAMPLE.run -
|
|
|
|
else
|
|
|
|
cargo $COMMAND $CARGO_FLAGS
|
|
|
|
fi
|
2019-02-11 00:25:33 +01:00
|
|
|
arm-none-eabi-objcopy -O ihex target/$TARGET/$BUILD_MODE/examples/$EXAMPLE ci/builds/${EXAMPLE}_${FEATURES_STR}${BUILD_MODE}_${BUILD_NUM}.hex
|
2019-01-16 08:21:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-04-12 06:12:06 +02:00
|
|
|
main() {
|
2018-11-03 17:02:41 +01:00
|
|
|
local T=$TARGET
|
|
|
|
|
2019-02-11 00:25:33 +01:00
|
|
|
mkdir -p ci/builds
|
|
|
|
|
2020-06-10 16:32:09 +02:00
|
|
|
# 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
|
|
|
|
|
2018-11-03 17:02:41 +01:00
|
|
|
if [ $T = x86_64-unknown-linux-gnu ]; then
|
2019-11-07 01:48:02 +01:00
|
|
|
if [[ $TRAVIS_RUST_VERSION == 1.*.* ]]; then
|
2019-11-07 01:39:57 +01:00
|
|
|
# test on a fixed version (MSRV) to avoid problems with changes in rustc diagnostics
|
|
|
|
# compile-fail tests
|
|
|
|
cargo test --test single --target $T
|
|
|
|
fi
|
2019-05-21 15:22:25 +02:00
|
|
|
|
2019-11-07 01:05:37 +01:00
|
|
|
if [ $TRAVIS_RUST_VERSION = nightly ]; then
|
2020-04-20 15:18:43 +02:00
|
|
|
# Tests where required MSRV > 1.36
|
2020-04-21 10:36:22 +02:00
|
|
|
#local exs=(
|
|
|
|
#)
|
|
|
|
#for ex in ${exs[@]}; do
|
|
|
|
# cargo check --example $ex --target $T
|
|
|
|
#done
|
2020-04-20 15:18:43 +02:00
|
|
|
|
2019-06-13 23:56:59 +02:00
|
|
|
# multi-core compile-pass tests
|
2019-06-18 10:31:31 +02:00
|
|
|
pushd heterogeneous
|
2019-06-13 23:56:59 +02:00
|
|
|
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
|
2018-11-03 17:02:41 +01:00
|
|
|
|
2019-06-13 23:56:59 +02:00
|
|
|
popd
|
2018-11-03 19:47:28 +01:00
|
|
|
|
2019-06-13 23:56:59 +02:00
|
|
|
else
|
|
|
|
if [ $TRAVIS_RUST_VERSION != nightly ]; then
|
|
|
|
rm -f .cargo/config
|
2018-12-16 19:34:16 +01:00
|
|
|
cargo doc
|
2019-06-13 23:56:59 +02:00
|
|
|
( 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/
|
2018-12-16 19:34:16 +01:00
|
|
|
fi
|
2018-11-03 19:47:28 +01:00
|
|
|
fi
|
|
|
|
|
2019-06-13 23:56:59 +02:00
|
|
|
cargo check --target $T
|
|
|
|
( cd macros && cargo test --target $T )
|
|
|
|
|
2017-04-12 06:12:06 +02:00
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
2019-06-13 23:56:59 +02:00
|
|
|
if [ $TARGET = thumbv6m-none-eabi ]; then
|
|
|
|
cargo check --target $T --examples
|
2020-06-10 14:07:23 +02:00
|
|
|
|
|
|
|
# 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
|
2019-06-13 23:56:59 +02:00
|
|
|
else
|
|
|
|
cargo check --target $T --examples --features __v7
|
2020-06-10 14:07:23 +02:00
|
|
|
|
|
|
|
# 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
|
2018-12-16 19:34:16 +01:00
|
|
|
fi
|
2018-11-03 17:02:41 +01:00
|
|
|
|
2019-06-18 10:31:31 +02:00
|
|
|
cargo check -p homogeneous --target $T --examples
|
|
|
|
|
2018-11-03 17:02:41 +01:00
|
|
|
# run-pass tests
|
|
|
|
case $T in
|
|
|
|
thumbv6m-none-eabi | thumbv7m-none-eabi)
|
|
|
|
local exs=(
|
|
|
|
idle
|
|
|
|
init
|
2019-08-21 10:17:27 +02:00
|
|
|
hardware
|
|
|
|
preempt
|
2019-02-23 22:20:30 +01:00
|
|
|
binds
|
2018-11-03 17:02:41 +01:00
|
|
|
|
|
|
|
resource
|
|
|
|
lock
|
|
|
|
late
|
2019-08-21 10:17:27 +02:00
|
|
|
only-shared-access
|
2018-11-03 17:02:41 +01:00
|
|
|
|
|
|
|
task
|
|
|
|
message
|
|
|
|
capacity
|
|
|
|
|
|
|
|
types
|
|
|
|
not-send
|
|
|
|
not-sync
|
2019-04-16 21:54:19 +02:00
|
|
|
shared-with-init
|
2018-11-03 17:02:41 +01:00
|
|
|
|
2018-11-04 18:50:42 +01:00
|
|
|
generics
|
2019-08-21 10:17:27 +02:00
|
|
|
cfg
|
2019-04-22 22:21:46 +02:00
|
|
|
pool
|
2018-11-03 17:02:41 +01:00
|
|
|
ramfunc
|
|
|
|
)
|
|
|
|
|
|
|
|
for ex in ${exs[@]}; do
|
2019-04-22 22:21:46 +02:00
|
|
|
if [ $ex = pool ]; then
|
2019-06-13 23:56:59 +02:00
|
|
|
if [ $TARGET = thumbv6m-none-eabi ]; then
|
|
|
|
continue
|
2019-04-22 22:21:46 +02:00
|
|
|
fi
|
|
|
|
|
2019-06-13 23:56:59 +02:00
|
|
|
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
|
|
|
|
|
2019-04-22 22:21:46 +02:00
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
2019-06-13 23:56:59 +02:00
|
|
|
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"
|
2017-12-23 21:34:24 +01:00
|
|
|
|
2019-06-13 23:56:59 +02:00
|
|
|
continue
|
2019-01-16 08:21:40 +01:00
|
|
|
fi
|
2019-06-13 23:56:59 +02:00
|
|
|
|
|
|
|
arm_example "run" $ex "debug" "" "1"
|
2019-08-21 10:17:27 +02:00
|
|
|
if [ $ex = types ]; then
|
|
|
|
arm_example "run" $ex "release" "" "1"
|
|
|
|
else
|
|
|
|
arm_example "build" $ex "release" "" "1"
|
|
|
|
fi
|
2019-01-16 08:21:40 +01:00
|
|
|
done
|
|
|
|
|
2019-02-15 20:37:06 +01:00
|
|
|
local built=()
|
2019-01-16 08:21:40 +01:00
|
|
|
cargo clean
|
|
|
|
for ex in ${exs[@]}; do
|
2019-06-13 23:56:59 +02:00
|
|
|
if [ $ex = types ] || [ $ex = pool ]; then
|
|
|
|
if [ $TARGET = thumbv6m-none-eabi ]; then
|
|
|
|
continue
|
|
|
|
fi
|
2019-01-17 02:57:54 +01:00
|
|
|
|
2019-06-13 23:56:59 +02:00
|
|
|
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
|
2019-05-21 15:22:25 +02:00
|
|
|
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
|
2018-11-03 17:02:41 +01:00
|
|
|
fi
|
|
|
|
|
2019-06-13 23:56:59 +02:00
|
|
|
built+=( $ex )
|
2018-11-03 17:02:41 +01:00
|
|
|
done
|
2019-02-15 20:37:06 +01:00
|
|
|
|
|
|
|
( cd target/$TARGET/release/examples/ && size ${built[@]} )
|
2018-11-03 17:02:41 +01:00
|
|
|
esac
|
2017-04-12 06:12:06 +02:00
|
|
|
}
|
|
|
|
|
2018-11-03 17:02:41 +01:00
|
|
|
# fake Travis variables to be able to run this on a local machine
|
|
|
|
if [ -z ${TRAVIS_BRANCH-} ]; then
|
|
|
|
TRAVIS_BRANCH=auto
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z ${TRAVIS_PULL_REQUEST-} ]; then
|
|
|
|
TRAVIS_PULL_REQUEST=false
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z ${TRAVIS_RUST_VERSION-} ]; then
|
|
|
|
case $(rustc -V) in
|
|
|
|
*nightly*)
|
|
|
|
TRAVIS_RUST_VERSION=nightly
|
|
|
|
;;
|
|
|
|
*beta*)
|
|
|
|
TRAVIS_RUST_VERSION=beta
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
TRAVIS_RUST_VERSION=stable
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
2019-02-08 11:54:41 +01:00
|
|
|
if [ -z ${TARGET-} ]; then
|
|
|
|
TARGET=$(rustc -Vv | grep host | cut -d ' ' -f2)
|
|
|
|
fi
|
|
|
|
|
2018-11-03 17:23:04 +01:00
|
|
|
if [ $TRAVIS_BRANCH != master ] || [ $TRAVIS_PULL_REQUEST != false ]; then
|
2018-08-27 14:45:43 +02:00
|
|
|
main
|
|
|
|
fi
|