@@ -7,10 +7,13 @@ main() {
77
88 cargo check --target " $TARGET " --features device
99
10+ # A `critical_section` implementation is always needed.
11+ needed_features=cortex-m/single-core-critical-section
12+
1013 if [ " $TARGET " = x86_64-unknown-linux-gnu ] && [ " $TRAVIS_RUST_VERSION " = stable ]; then
1114 ( cd macros && cargo check && cargo test )
1215
13- cargo test --features device --test compiletest
16+ cargo test --features " device, ${needed_features} " --test compiletest
1417 fi
1518
1619 local examples=(
@@ -43,35 +46,35 @@ main() {
4346 if [ " $TARGET " != x86_64-unknown-linux-gnu ]; then
4447 # Only test on stable and nightly, not MSRV.
4548 if [ " $TRAVIS_RUST_VERSION " = stable ] || [ " $TRAVIS_RUST_VERSION " = nightly ]; then
46- RUSTDOCFLAGS=" -Cpanic=abort" cargo test --doc
49+ RUSTDOCFLAGS=" -Cpanic=abort" cargo test --features " ${needed_features} " -- doc
4750 fi
4851
4952 for linker in " ${linkers[@]} " ; do
5053 for ex in " ${examples[@]} " ; do
51- cargo rustc --target " $TARGET " --example " $ex " -- $linker
52- cargo rustc --target " $TARGET " --example " $ex " --release -- $linker
54+ cargo rustc --target " $TARGET " --example " $ex " --features " ${needed_features} " -- $linker
55+ cargo rustc --target " $TARGET " --example " $ex " --features " ${needed_features} " -- release -- $linker
5356 done
5457 for ex in " ${fail_examples[@]} " ; do
55- ! cargo rustc --target " $TARGET " --example " $ex " -- $linker
56- ! cargo rustc --target " $TARGET " --example " $ex " --release -- $linker
58+ ! cargo rustc --target " $TARGET " --example " $ex " --features " ${needed_features} " -- $linker
59+ ! cargo rustc --target " $TARGET " --example " $ex " --features " ${needed_features} " -- release -- $linker
5760 done
58- cargo rustc --target " $TARGET " --example device --features device -- $linker
59- cargo rustc --target " $TARGET " --example device --features device --release -- $linker
61+ cargo rustc --target " $TARGET " --example device --features " device, ${needed_features} " -- $linker
62+ cargo rustc --target " $TARGET " --example device --features " device, ${needed_features} " --release -- $linker
6063
61- cargo rustc --target " $TARGET " --example minimal --features set-sp -- $linker
62- cargo rustc --target " $TARGET " --example minimal --features set-sp --release -- $linker
63- cargo rustc --target " $TARGET " --example minimal --features set-vtor -- $linker
64- cargo rustc --target " $TARGET " --example minimal --features set-vtor --release -- $linker
64+ cargo rustc --target " $TARGET " --example minimal --features " set-sp, ${needed_features} " -- $linker
65+ cargo rustc --target " $TARGET " --example minimal --features " set-sp, ${needed_features} " --release -- $linker
66+ cargo rustc --target " $TARGET " --example minimal --features " set-vtor, ${needed_features} " -- $linker
67+ cargo rustc --target " $TARGET " --example minimal --features " set-vtor, ${needed_features} " --release -- $linker
6568 done
6669 fi
6770
6871 case $TARGET in
6972 thumbv6m-none-eabi|thumbv7m-none-eabi)
7073 for linker in " ${linkers[@]} " ; do
7174 env RUSTFLAGS=" $linker -C link-arg=-Tlink.x" cargo run \
72- --target " $TARGET " --example qemu | grep " x = 42"
75+ --target " $TARGET " --features " ${needed_features} " -- example qemu | grep " x = 42"
7376 env RUSTFLAGS=" $linker -C link-arg=-Tlink.x" cargo run \
74- --target " $TARGET " --example qemu --release | grep " x = 42"
77+ --target " $TARGET " --features " ${needed_features} " -- example qemu --release | grep " x = 42"
7578 done
7679
7780 ;;
0 commit comments