Skip to content

Commit 0457438

Browse files
Merge #218
218: CI: Add shebangs and address shellcheck warnings r=adamgreig a=jonas-schievink Co-authored-by: Jonas Schievink <[email protected]>
2 parents 2f11f0b + 528b1bd commit 0457438

File tree

2 files changed

+27
-23
lines changed

2 files changed

+27
-23
lines changed

cortex-m-rt/ci/install.sh

100644100755
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
#!/usr/bin/env bash
2+
13
set -euxo pipefail
24

35
main() {
4-
if [ $TARGET != x86_64-unknown-linux-gnu ]; then
5-
rustup target add $TARGET
6+
if [ "$TARGET" != x86_64-unknown-linux-gnu ]; then
7+
rustup target add "$TARGET"
68
fi
79

810
mkdir gcc

cortex-m-rt/ci/script.sh

100644100755
Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
#!/usr/bin/env bash
2+
13
set -euxo pipefail
24

35
main() {
4-
cargo check --target $TARGET
6+
cargo check --target "$TARGET"
57

6-
cargo check --target $TARGET --features device
8+
cargo check --target "$TARGET" --features device
79

8-
if [ $TARGET = x86_64-unknown-linux-gnu ] && [ $TRAVIS_RUST_VERSION = stable ]; then
10+
if [ "$TARGET" = x86_64-unknown-linux-gnu ] && [ "$TRAVIS_RUST_VERSION" = stable ]; then
911
( cd macros && cargo check && cargo test )
1012

1113
cargo test --features device --test compiletest
@@ -31,56 +33,56 @@ main() {
3133
local fail_examples=(
3234
data_overflow
3335
)
34-
if [ $TARGET != x86_64-unknown-linux-gnu ]; then
36+
if [ "$TARGET" != x86_64-unknown-linux-gnu ]; then
3537
# linking with GNU LD
3638
for ex in "${examples[@]}"; do
37-
cargo rustc --target $TARGET --example $ex -- \
39+
cargo rustc --target "$TARGET" --example "$ex" -- \
3840
-C linker=arm-none-eabi-ld
3941

40-
cargo rustc --target $TARGET --example $ex --release -- \
42+
cargo rustc --target "$TARGET" --example "$ex" --release -- \
4143
-C linker=arm-none-eabi-ld
4244
done
4345
for ex in "${fail_examples[@]}"; do
44-
! cargo rustc --target $TARGET --example $ex -- \
46+
! cargo rustc --target "$TARGET" --example "$ex" -- \
4547
-C linker=arm-none-eabi-ld
4648

47-
! cargo rustc --target $TARGET --example $ex --release -- \
49+
! cargo rustc --target "$TARGET" --example "$ex" --release -- \
4850
-C linker=arm-none-eabi-ld
4951
done
5052

51-
cargo rustc --target $TARGET --example device --features device -- \
53+
cargo rustc --target "$TARGET" --example device --features device -- \
5254
-C linker=arm-none-eabi-ld
5355

54-
cargo rustc --target $TARGET --example device --features device --release -- \
56+
cargo rustc --target "$TARGET" --example device --features device --release -- \
5557
-C linker=arm-none-eabi-ld
5658

5759
# linking with rustc's LLD
5860
for ex in "${examples[@]}"; do
59-
cargo rustc --target $TARGET --example $ex
60-
cargo rustc --target $TARGET --example $ex --release
61+
cargo rustc --target "$TARGET" --example "$ex"
62+
cargo rustc --target "$TARGET" --example "$ex" --release
6163
done
6264
for ex in "${fail_examples[@]}"; do
63-
! cargo rustc --target $TARGET --example $ex
64-
! cargo rustc --target $TARGET --example $ex --release
65+
! cargo rustc --target "$TARGET" --example "$ex"
66+
! cargo rustc --target "$TARGET" --example "$ex" --release
6567
done
6668

67-
cargo rustc --target $TARGET --example device --features device
68-
cargo rustc --target $TARGET --example device --features device --release
69+
cargo rustc --target "$TARGET" --example device --features device
70+
cargo rustc --target "$TARGET" --example device --features device --release
6971
fi
7072

7173
case $TARGET in
7274
thumbv6m-none-eabi|thumbv7m-none-eabi)
7375
# linking with GNU LD
74-
env RUSTFLAGS="-C linker=arm-none-eabi-ld -C link-arg=-Tlink.x" cargo run --target $TARGET --example qemu | grep "x = 42"
75-
env RUSTFLAGS="-C linker=arm-none-eabi-ld -C link-arg=-Tlink.x" cargo run --target $TARGET --example qemu --release | grep "x = 42"
76+
env RUSTFLAGS="-C linker=arm-none-eabi-ld -C link-arg=-Tlink.x" cargo run --target "$TARGET" --example qemu | grep "x = 42"
77+
env RUSTFLAGS="-C linker=arm-none-eabi-ld -C link-arg=-Tlink.x" cargo run --target "$TARGET" --example qemu --release | grep "x = 42"
7678

7779
# linking with rustc's LLD
78-
cargo run --target $TARGET --example qemu | grep "x = 42"
79-
cargo run --target $TARGET --example qemu --release | grep "x = 42"
80+
cargo run --target "$TARGET" --example qemu | grep "x = 42"
81+
cargo run --target "$TARGET" --example qemu --release | grep "x = 42"
8082
;;
8183
esac
8284

83-
if [ $TARGET = x86_64-unknown-linux-gnu ]; then
85+
if [ "$TARGET" = x86_64-unknown-linux-gnu ]; then
8486
./check-blobs.sh
8587
fi
8688
}

0 commit comments

Comments
 (0)