Skip to content

Commit 3224df5

Browse files
Merge pull request #86 from thejpster/update-ci
Update CI and test script
2 parents d2ac569 + 69c3656 commit 3224df5

File tree

6 files changed

+102
-161
lines changed

6 files changed

+102
-161
lines changed

.cargo/config.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,3 @@ runner = "qemu-system-arm -machine versatileab -cpu arm926 -semihosting -nograph
2727

2828
[target.thumbv4t-none-eabi]
2929
runner = "qemu-system-arm -machine versatileab -cpu pxa250 -semihosting -nographic -audio none -kernel"
30-
31-
[unstable]
32-
build-std = ["core", "alloc"]

.github/workflows/build.yml

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,13 @@ jobs:
1616
echo 'rust_versions={"rust": ["stable", "1.83"]}' >> "$GITHUB_OUTPUT"
1717
1818
# Build the workspace for a target architecture
19-
build:
19+
build-tier2:
2020
runs-on: ubuntu-24.04
2121
needs: setup
2222
strategy:
2323
matrix:
2424
rust: ${{ fromJSON(needs.setup.outputs.matrix).rust }}
2525
target:
26-
- armebv7r-none-eabi
27-
- armebv7r-none-eabihf
2826
- armv7r-none-eabi
2927
- armv7r-none-eabihf
3028
- armv7a-none-eabi
@@ -38,101 +36,112 @@ jobs:
3836
rustup target add ${{ matrix.target }}
3937
- name: Build
4038
run: |
41-
cargo build --target ${{ matrix.target }} --features "serde, defmt, check-asm"
42-
cargo build --target ${{ matrix.target }} --no-default-features
39+
cargo build --target ${{ matrix.target }}
40+
cargo build --target ${{ matrix.target }} --features "serde, defmt, critical-section-multi-core, check-asm"
41+
cargo build --target ${{ matrix.target }} --features "serde, defmt, critical-section-single-core, check-asm"
4342
44-
build-versatileab:
43+
# These targets are in nightly and coming to stable soon
44+
build-tier2-nightly:
4545
runs-on: ubuntu-24.04
4646
needs: setup
4747
strategy:
4848
matrix:
49-
rust: ${{ fromJSON(needs.setup.outputs.matrix).rust }}
49+
target:
50+
- armv7a-none-eabi
51+
- armv7a-none-eabihf
52+
- armv7r-none-eabi
53+
- armv7r-none-eabihf
54+
- armv8r-none-eabihf
5055
steps:
5156
- name: Checkout
5257
uses: actions/checkout@v4
5358
- name: Install rust
5459
run: |
55-
rustup install ${{ matrix.rust }}
56-
rustup default ${{ matrix.rust }}
57-
rustup target add armv7a-none-eabi
58-
rustup target add armv7r-none-eabi
59-
rustup target add armv7r-none-eabihf
60+
rustup install nightly-2025-10-29
61+
rustup target add ${{ matrix.target }} --toolchain nightly-2025-10-29
6062
- name: Build
6163
run: |
62-
cargo build --manifest-path ./examples/versatileab/Cargo.toml --target armv7a-none-eabi
63-
cargo build --manifest-path ./examples/versatileab/Cargo.toml --target armv7r-none-eabi
64-
cargo build --manifest-path ./examples/versatileab/Cargo.toml --target armv7r-none-eabihf
64+
cargo +nightly-2025-10-29 build --target ${{ matrix.target }}
65+
cargo +nightly-2025-10-29 build --target ${{ matrix.target }} --features "serde, defmt, critical-section-multi-core, check-asm"
66+
cargo +nightly-2025-10-29 build --target ${{ matrix.target }} --features "serde, defmt, critical-section-single-core, check-asm"
6567
66-
build-mps3-an536:
68+
# These targets need build-std, and have no atomics so cannot build the critical-section module
69+
build-tier3-no-atomics:
6770
runs-on: ubuntu-24.04
6871
needs: setup
6972
strategy:
7073
matrix:
71-
rust: ${{ fromJSON(needs.setup.outputs.matrix).rust }}
74+
target:
75+
- armv4t-none-eabi
76+
- thumbv4t-none-eabi
77+
- armv5te-none-eabi
78+
- thumbv5te-none-eabi
7279
steps:
7380
- name: Checkout
7481
uses: actions/checkout@v4
7582
- name: Install rust
7683
run: |
77-
rustup install nightly
78-
rustup default nightly
79-
rustup component add rust-src --toolchain nightly
84+
rustup install nightly-2025-10-29
85+
rustup component add rust-src --toolchain nightly-2025-10-29
8086
- name: Build
8187
run: |
82-
cargo build --manifest-path ./examples/mps3-an536/Cargo.toml --target armv8r-none-eabihf -Zbuild-std=core
88+
cargo +nightly-2025-10-29 build --target ${{ matrix.target }} -Zbuild-std=core
89+
cargo +nightly-2025-10-29 build --target ${{ matrix.target }} -Zbuild-std=core --features "serde, defmt, check-asm"
8390
84-
# Build the host tools
85-
build-host:
91+
build-versatileab:
8692
runs-on: ubuntu-24.04
8793
needs: setup
8894
strategy:
8995
matrix:
90-
rust: [stable, 1.59]
96+
rust: ${{ fromJSON(needs.setup.outputs.matrix).rust }}
9197
steps:
9298
- name: Checkout
9399
uses: actions/checkout@v4
94-
- name: Install rust
100+
- name: Build
95101
run: |
96-
rustup install ${{ matrix.rust }}
97-
rustup default ${{ matrix.rust }}
102+
cd examples/versatileab
103+
cargo build --target armv7a-none-eabi
104+
cargo build --target armv7r-none-eabi
105+
cargo build --target armv7r-none-eabihf
106+
107+
build-mps3-an536:
108+
runs-on: ubuntu-24.04
109+
needs: setup
110+
strategy:
111+
matrix:
112+
rust: ${{ fromJSON(needs.setup.outputs.matrix).rust }}
113+
steps:
114+
- name: Checkout
115+
uses: actions/checkout@v4
98116
- name: Build
99117
run: |
100-
cd arm-targets
101-
cargo build
102-
cargo test
118+
cd examples/mps3-an536
119+
cargo build --target armv8r-none-eabihf
103120
104-
# Build the workspace for the target architecture but using nightly to compile libcore
105-
# Technically it doesn't need 'setup' but it makes the graph look nicer
106-
build-tier3:
121+
# Build the host tools
122+
build-host:
107123
runs-on: ubuntu-24.04
108124
needs: setup
109125
strategy:
110126
matrix:
111-
target:
112-
- armv7a-none-eabi
113-
- armv7a-none-eabihf
114-
- armv7r-none-eabi
115-
- armv7r-none-eabihf
116-
- armv8r-none-eabihf
117-
- armebv7r-none-eabi
118-
- armebv7r-none-eabihf
127+
rust: [stable, 1.59]
119128
steps:
120129
- name: Checkout
121130
uses: actions/checkout@v4
122131
- name: Install rust
123132
run: |
124-
rustup install nightly
125-
rustup default nightly
126-
rustup component add rust-src --toolchain nightly
133+
rustup install ${{ matrix.rust }}
134+
rustup default ${{ matrix.rust }}
127135
- name: Build
128136
run: |
129-
cargo build --target ${{ matrix.target }} -Zbuild-std=core --features "serde, defmt, check-asm"
130-
cargo build --target ${{ matrix.target }} -Zbuild-std=core --no-default-features
137+
cd arm-targets
138+
cargo build
139+
cargo test
131140
132141
# Gather all the above build jobs together for the purposes of getting an overall pass-fail
133142
build-all:
134143
runs-on: ubuntu-24.04
135-
needs: [build, build-tier3, build-host, build-versatileab, build-mps3-an536]
144+
needs: [build-tier2, build-tier2-nightly, build-tier3-no-atomics, build-host, build-versatileab, build-mps3-an536]
136145
steps:
137146
- run: /bin/true
138147

@@ -145,8 +154,6 @@ jobs:
145154
rust: ${{ fromJSON(needs.setup.outputs.matrix).rust }}
146155
target:
147156
- armv7a-none-eabi
148-
- armebv7r-none-eabi
149-
- armebv7r-none-eabihf
150157
- armv7r-none-eabi
151158
- armv7r-none-eabihf
152159
steps:
@@ -160,7 +167,6 @@ jobs:
160167
- name: Build docs
161168
run: |
162169
cargo doc --target ${{ matrix.target }}
163-
cargo doc --target ${{ matrix.target }} --no-default-features
164170
cargo doc --target ${{ matrix.target }} --all-features
165171
166172
# Build the docs for the host tools
@@ -235,8 +241,6 @@ jobs:
235241
matrix:
236242
rust: ${{ fromJSON(needs.setup.outputs.matrix).rust }}
237243
target:
238-
- armebv7r-none-eabi
239-
- armebv7r-none-eabihf
240244
- armv7r-none-eabi
241245
- armv7r-none-eabihf
242246
- armv7a-none-eabi
@@ -303,10 +307,6 @@ jobs:
303307
steps:
304308
- name: Checkout
305309
uses: actions/checkout@v4
306-
- name: Install rust
307-
run: |
308-
rustup install 1.89
309-
rustup default 1.89
310310
- name: Install Dependencies
311311
run: |
312312
sudo apt-get -y update

examples/mps3-an536/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@ arm-targets = {version = "0.3.0", path = "../../arm-targets"}
2929

3030
[features]
3131
eabi-fpu = ["aarch32-rt/eabi-fpu"]
32+
fpu-d32 = ["aarch32-rt/fpu-d32"]
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
[toolchain]
2-
channel = "nightly"
2+
channel = "nightly-2025-10-29"
3+
targets = [
4+
"armv8r-none-eabihf",
5+
]
6+
components = ["rust-src"]
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[toolchain]
2+
channel = "nightly-2025-10-29"
3+
targets = [
4+
"armv7r-none-eabi",
5+
"armv7r-none-eabihf",
6+
"armv7a-none-eabi",
7+
"armv7a-none-eabihf",
8+
]
9+
components = ["rust-src"]

tests.sh

Lines changed: 31 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@
33
# Runs a series of sample programs in QEMU and checks that the standard output
44
# is as expected.
55

6-
rustup target add armv7r-none-eabi
7-
rustup target add armv7r-none-eabihf
8-
rustup target add armv7a-none-eabi
9-
rustup component add rust-src
10-
116
# Set this to 1 to exit on the first error
127
EXIT_FAST=0
138

@@ -25,9 +20,6 @@ fail() {
2520

2621
mkdir -p ./target
2722

28-
versatile_ab_cargo="--manifest-path examples/versatileab/Cargo.toml"
29-
mps3_an536_cargo="--manifest-path examples/mps3-an536/Cargo.toml"
30-
3123
my_diff() {
3224
file_a=$1
3325
file_b=$2
@@ -46,101 +38,39 @@ my_diff() {
4638
fi
4739
}
4840

49-
# armv7r-none-eabi tests
50-
cargo build ${versatile_ab_cargo} --target=armv7r-none-eabi || exit 1
51-
for bin_path in $(ls examples/versatileab/src/bin/*.rs); do
52-
filename=${bin_path##*/}
53-
binary=${filename%.rs}
54-
cargo run ${versatile_ab_cargo} --target=armv7r-none-eabi --bin $binary > ./target/$binary-armv7r-none-eabi.out
55-
my_diff ./examples/versatileab/reference/$binary-armv7r-none-eabi.out ./target/$binary-armv7r-none-eabi.out || fail $binary "armv7r-none-eabi"
56-
done
57-
58-
# armv7r-none-eabihf tests
59-
cargo build ${versatile_ab_cargo} --target=armv7r-none-eabihf || exit 1
60-
for bin_path in $(ls examples/versatileab/src/bin/*.rs); do
61-
filename=${bin_path##*/}
62-
binary=${filename%.rs}
63-
cargo run ${versatile_ab_cargo} --target=armv7r-none-eabihf --bin $binary > ./target/$binary-armv7r-none-eabihf.out
64-
my_diff ./examples/versatileab/reference/$binary-armv7r-none-eabihf.out ./target/$binary-armv7r-none-eabihf.out || fail $binary "armv7r-none-eabihf"
65-
done
66-
67-
# armv7a-none-eabi tests
68-
cargo build ${versatile_ab_cargo} --target=armv7a-none-eabi || exit 1
69-
for bin_path in $(ls examples/versatileab/src/bin/*.rs); do
70-
filename=${bin_path##*/}
71-
binary=${filename%.rs}
72-
cargo run ${versatile_ab_cargo} --target=armv7a-none-eabi --bin $binary > ./target/$binary-armv7a-none-eabi.out
73-
my_diff ./examples/versatileab/reference/$binary-armv7a-none-eabi.out ./target/$binary-armv7a-none-eabi.out || fail $binary "armv7a-none-eabi"
74-
done
75-
76-
# armv7a-none-eabihf tests
77-
RUSTC_BOOTSTRAP=1 cargo build ${versatile_ab_cargo} --target=armv7a-none-eabihf || exit 1
78-
for bin_path in $(ls examples/versatileab/src/bin/*.rs); do
79-
filename=${bin_path##*/}
80-
binary=${filename%.rs}
81-
RUSTC_BOOTSTRAP=1 cargo run ${versatile_ab_cargo} --target=armv7a-none-eabihf --bin $binary > ./target/$binary-armv7a-none-eabihf.out
82-
my_diff ./examples/versatileab/reference/$binary-armv7a-none-eabihf.out ./target/$binary-armv7a-none-eabihf.out || fail $binary "armv7a-none-eabihf"
83-
done
84-
85-
# armv7a-none-eabihf double-precision tests
86-
RUSTC_BOOTSTRAP=1 RUSTFLAGS="-Ctarget-feature=+d32" cargo build ${versatile_ab_cargo} --target=armv7a-none-eabihf --features=fpu-d32 || exit 1
87-
for bin_path in $(ls examples/versatileab/src/bin/*.rs); do
88-
filename=${bin_path##*/}
89-
binary=${filename%.rs}
90-
RUSTC_BOOTSTRAP=1 RUSTFLAGS="-Ctarget-feature=+d32" cargo run ${versatile_ab_cargo} --target=armv7a-none-eabihf --bin $binary --features=fpu-d32 > ./target/$binary-armv7a-none-eabihf-dp.out
91-
my_diff ./examples/versatileab/reference/$binary-armv7a-none-eabihf.out ./target/$binary-armv7a-none-eabihf-dp.out || fail $binary "armv7a-none-eabihf"
92-
done
93-
94-
# armv5te-none-eabi tests
95-
RUSTC_BOOTSTRAP=1 cargo build ${versatile_ab_cargo} --target=armv5te-none-eabi
96-
for bin_path in $(ls examples/versatileab/src/bin/*.rs); do
97-
filename=${bin_path##*/}
98-
binary=${filename%.rs}
99-
RUSTC_BOOTSTRAP=1 cargo run ${versatile_ab_cargo} --target=armv5te-none-eabi --bin $binary > ./target/$binary-armv5te-none-eabi.out
100-
my_diff ./examples/versatileab/reference/$binary-armv5te-none-eabi.out ./target/$binary-armv5te-none-eabi.out || fail $binary "armv5te-none-eabi"
101-
done
102-
103-
# thumbv5te-none-eabi tests
104-
RUSTC_BOOTSTRAP=1 cargo build ${versatile_ab_cargo} --target=thumbv5te-none-eabi
105-
for bin_path in $(ls examples/versatileab/src/bin/*.rs); do
106-
filename=${bin_path##*/}
107-
binary=${filename%.rs}
108-
RUSTC_BOOTSTRAP=1 cargo run ${versatile_ab_cargo} --target=thumbv5te-none-eabi --bin $binary > ./target/$binary-thumbv5te-none-eabi.out
109-
my_diff ./examples/versatileab/reference/$binary-thumbv5te-none-eabi.out ./target/$binary-thumbv5te-none-eabi.out || fail $binary "thumbv5te-none-eabi"
110-
done
111-
112-
# armv4t-none-eabi tests
113-
RUSTC_BOOTSTRAP=1 cargo build ${versatile_ab_cargo} --target=armv4t-none-eabi
114-
for bin_path in $(ls examples/versatileab/src/bin/*.rs); do
115-
filename=${bin_path##*/}
116-
binary=${filename%.rs}
117-
RUSTC_BOOTSTRAP=1 cargo run ${versatile_ab_cargo} --target=armv4t-none-eabi --bin $binary > ./target/$binary-armv4t-none-eabi.out
118-
my_diff ./examples/versatileab/reference/$binary-armv4t-none-eabi.out ./target/$binary-armv4t-none-eabi.out || fail $binary "armv4t-none-eabi"
119-
done
120-
121-
# thumbv4t-none-eabi tests
122-
RUSTC_BOOTSTRAP=1 cargo build ${versatile_ab_cargo} --target=thumbv4t-none-eabi
123-
for bin_path in $(ls examples/versatileab/src/bin/*.rs); do
124-
filename=${bin_path##*/}
125-
binary=${filename%.rs}
126-
RUSTC_BOOTSTRAP=1 cargo run ${versatile_ab_cargo} --target=thumbv4t-none-eabi --bin $binary > ./target/$binary-thumbv4t-none-eabi.out
127-
my_diff ./examples/versatileab/reference/$binary-thumbv4t-none-eabi.out ./target/$binary-thumbv4t-none-eabi.out || fail $binary "thumbv4t-none-eabi"
128-
done
129-
130-
# These tests only run on QEMU 9 or higher.
131-
# Ubuntu 24.04 supplies QEMU 8, which doesn't support the machine we have configured for this target
132-
RUSTC_BOOTSTRAP=1 cargo build ${mps3_an536_cargo} --target=armv8r-none-eabihf || exit 1
133-
if qemu-system-arm --version | grep "version \(9\|10\)"; then
134-
# armv8r-none-eabihf tests
135-
for bin_path in $(ls examples/mps3-an536/src/bin/*.rs); do
136-
filename=${bin_path##*/}
41+
run_tests() {
42+
directory=$1
43+
target="$2"
44+
flags=$3
45+
echo "Running directory=$directory target=$target flags=$flags"
46+
pushd $directory
47+
cargo build --target=$target $flags || exit 1
48+
for bin_path in src/bin/*.rs; do
49+
filename=$(basename $bin_path)
13750
binary=${filename%.rs}
138-
RUSTC_BOOTSTRAP=1 cargo run ${mps3_an536_cargo} --target=armv8r-none-eabihf --bin $binary > ./target/$binary-armv8r-none-eabihf.out
139-
my_diff ./examples/mps3-an536/reference/$binary-armv8r-none-eabihf.out ./target/$binary-armv8r-none-eabihf.out || fail $binary "armv8r-none-eabihf"
51+
cargo run --target=$target --bin $binary $flags > ./target/$binary-$target.out
52+
my_diff ./reference/$binary-$target.out ./target/$binary-$target.out || fail $binary $target
14053
done
141-
RUSTC_BOOTSTRAP=1 cargo run ${mps3_an536_cargo} --target=armv8r-none-eabihf --bin smp_test -- -smp 2 > ./target/smp_test-armv8r-none-eabihf_smp2.out
142-
my_diff ./examples/mps3-an536/reference/smp_test-armv8r-none-eabihf_smp2.out ./target/smp_test-armv8r-none-eabihf_smp2.out || fail smp_test "armv8r-none-eabihf"
143-
fi
54+
popd
55+
}
56+
57+
run_tests examples/versatileab armv7r-none-eabi ""
58+
run_tests examples/versatileab armv7r-none-eabihf ""
59+
run_tests examples/versatileab armv7a-none-eabi ""
60+
run_tests examples/versatileab armv7a-none-eabihf ""
61+
RUSTFLAGS="-Ctarget-feature=+d32" run_tests examples/versatileab armv7a-none-eabihf "--features=fpu-d32"
62+
run_tests examples/versatileab armv5te-none-eabi "-Zbuild-std=core"
63+
run_tests examples/versatileab armv4t-none-eabi "-Zbuild-std=core"
64+
run_tests examples/versatileab thumbv5te-none-eabi "-Zbuild-std=core"
65+
run_tests examples/versatileab thumbv4t-none-eabi "-Zbuild-std=core"
66+
run_tests examples/mps3-an536 armv8r-none-eabihf ""
67+
RUSTFLAGS="-Ctarget-cpu=cortex-r52" run_tests examples/mps3-an536 armv8r-none-eabihf "--features=fpu-d32"
68+
69+
# Special case the SMP test. You can't run the normal examples with two CPUs because nothing stops the second CPU from running :/
70+
pushd examples/mps3-an536
71+
cargo run --target=armv8r-none-eabihf --bin smp_test -- --smp 2 > ./target/smp_test-armv8r-none-eabihf_smp2.out
72+
my_diff ./reference/smp_test-armv8r-none-eabihf_smp2.out ./target/smp_test-armv8r-none-eabihf_smp2.out || fail smp_test armv8r-none-eabihf
73+
popd
14474

14575
if [ "$FAILURE" == "1" ]; then
14676
echo "***************************************************"

0 commit comments

Comments
 (0)