aboutsummaryrefslogtreecommitdiff
path: root/ci/script.sh
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-02-15 23:39:28 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-02-15 23:39:28 +0000
commitc91b14bcd49f05ea40617dbd3166afa63234cb91 (patch)
tree1a7c65d4a68619966e4a133dd165de7a3ec64c6b /ci/script.sh
parentfdba26525c4a190d0275dd3b5f3a154fa189a799 (diff)
parente5e54ee8f1b7afca614f642ee064a7f00a1f8548 (diff)
Merge #151
151: make builds reproducible r=japaric a=japaric This is a rebased and augmented version of #132. With this PR both dev and release builds that do not use the owned-singleton stuff become reproducible. (I haven't really bothered to make owned-singleton reproducible since [lifo] is way more ergonomic than [alloc-singleton] and will eventually make its way into heapless). [lifo]: https://github.com/japaric/lifo [alloc-singleton]: https://crates.io/crates/alloc-singleton Thanks @hugwijst for doing the bulk of the work! closes #132 Co-authored-by: Hugo van der Wijst <hvanderwijst@tesla.com> Co-authored-by: Hugo van der Wijst <hugo@wij.st> Co-authored-by: Jorge Aparicio <jorge@japaric.io>
Diffstat (limited to 'ci/script.sh')
-rw-r--r--ci/script.sh73
1 files changed, 64 insertions, 9 deletions
diff --git a/ci/script.sh b/ci/script.sh
index 645db3a..4b9cd22 100644
--- a/ci/script.sh
+++ b/ci/script.sh
@@ -1,8 +1,41 @@
set -euxo pipefail
+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
+ arm-none-eabi-objcopy -O ihex target/$TARGET/$BUILD_MODE/examples/$EXAMPLE ci/builds/${EXAMPLE}_${FEATURES_STR}${BUILD_MODE}_${BUILD_NUM}.hex
+}
+
+
main() {
local T=$TARGET
+ mkdir -p ci/builds
+
if [ $T = x86_64-unknown-linux-gnu ]; then
# compile-fail and compile-pass tests
case $TRAVIS_RUST_VERSION in
@@ -82,19 +115,41 @@ main() {
fi
if [ $ex != types ]; then
- cargo run --example $ex --target $T | \
- diff -u ci/expected/$ex.run -
-
- cargo run --example $ex --target $T --release | \
- diff -u ci/expected/$ex.run -
+ arm_example "run" $ex "debug" "" "1"
+ arm_example "run" $ex "release" "" "1"
fi
if [ $TARGET != thumbv6m-none-eabi ]; then
- cargo run --features timer-queue --example $ex --target $T | \
- diff -u ci/expected/$ex.run -
+ arm_example "run" $ex "debug" "timer-queue" "1"
+ arm_example "run" $ex "release" "timer-queue" "1"
+ fi
+ done
- cargo run --features timer-queue --example $ex --target $T --release | \
- diff -u ci/expected/$ex.run -
+ 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
+ fi
+
+ if [ $ex != types ]; then
+ 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 [ $TARGET != thumbv6m-none-eabi ]; then
+ arm_example "build" $ex "debug" "timer-queue" "2"
+ cmp ci/builds/${ex}_timer-queue_debug_1.hex ci/builds/${ex}_timer-queue_debug_2.hex
+ arm_example "build" $ex "release" "timer-queue" "2"
+ cmp ci/builds/${ex}_timer-queue_release_1.hex ci/builds/${ex}_timer-queue_release_2.hex
fi
done
esac