mirror of
https://github.com/rtic-rs/rtic.git
synced 2025-12-18 13:55:23 +01:00
implement run-pass tests as xtasks
`
This commit is contained in:
parent
bf9df9fe73
commit
d172df6f0a
8 changed files with 611 additions and 132 deletions
135
.github/workflows/build.yml
vendored
135
.github/workflows/build.yml
vendored
|
|
@ -198,139 +198,10 @@ jobs:
|
|||
sudo apt update
|
||||
sudo apt install -y qemu-system-arm
|
||||
|
||||
|
||||
- name: Run-pass tests
|
||||
run: |
|
||||
# Print the path
|
||||
echo $PATH
|
||||
|
||||
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 ${{ matrix.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
|
||||
cargo objcopy $CARGO_FLAGS -- -O ihex ci/builds/${EXAMPLE}_${FEATURES_STR}${BUILD_MODE}_${BUILD_NUM}.hex
|
||||
}
|
||||
|
||||
mkdir -p ci/builds
|
||||
exs=(
|
||||
idle
|
||||
init
|
||||
hardware
|
||||
preempt
|
||||
binds
|
||||
|
||||
resource
|
||||
lock
|
||||
multilock
|
||||
only-shared-access
|
||||
|
||||
task
|
||||
message
|
||||
capacity
|
||||
|
||||
not-sync
|
||||
|
||||
generics
|
||||
pool
|
||||
ramfunc
|
||||
|
||||
peripherals-taken
|
||||
)
|
||||
|
||||
for ex in ${exs[@]}; do
|
||||
if [ $ex = pool ]; then
|
||||
if [ ${{ matrix.target }} = thumbv6m-none-eabi ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
td=$(mktemp -d)
|
||||
|
||||
cargo run --example $ex --target ${{ matrix.target }} --features __v7 >\
|
||||
$td/pool.run
|
||||
grep 'foo(0x2' $td/pool.run
|
||||
grep 'bar(0x2' $td/pool.run
|
||||
cargo objcopy --example $ex --target ${{ matrix.target }} --features __v7 -- -O ihex ci/builds/${ex}___v7_debug_1.hex
|
||||
|
||||
cargo run --example $ex --target ${{ matrix.target }} --features __v7 --release >\
|
||||
$td/pool.run
|
||||
grep 'foo(0x2' $td/pool.run
|
||||
grep 'bar(0x2' $td/pool.run
|
||||
cargo objcopy --example $ex --target ${{ matrix.target }} --features __v7 --release -- -O ihex ci/builds/${ex}___v7_release_1.hex
|
||||
|
||||
rm -rf $td
|
||||
|
||||
continue
|
||||
fi
|
||||
|
||||
if [ $ex = types ]; then
|
||||
if [ ${{ matrix.target }} = thumbv6m-none-eabi ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
arm_example "run" $ex "debug" "__v7" "1"
|
||||
arm_example "run" $ex "release" "__v7" "1"
|
||||
|
||||
continue
|
||||
fi
|
||||
|
||||
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
|
||||
|
||||
built=()
|
||||
cargo clean
|
||||
for ex in ${exs[@]}; do
|
||||
if [ $ex = types ] || [ $ex = pool ]; then
|
||||
if [ ${{ matrix.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
|
||||
|
||||
built+=( $ex )
|
||||
done
|
||||
|
||||
( cd target/${{ matrix.target }}/release/examples/ && size ${built[@]} )
|
||||
|
||||
run:
|
||||
cargo xtask --target ${{ matrix.target }}
|
||||
|
||||
# Check the correctness of macros/ crate
|
||||
checkmacros:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue