Skip to content

Commit 5ce97b9

Browse files
Add Windows build.
QEMU 9 is available for Windows, but not for Ubuntu 24.04 (unless you compile it from source, and I don't want to do that).
1 parent 07e1535 commit 5ce97b9

File tree

2 files changed

+41
-9
lines changed

2 files changed

+41
-9
lines changed

.github/workflows/build.yml

+27-5
Original file line numberDiff line numberDiff line change
@@ -292,19 +292,41 @@ jobs:
292292
run: |
293293
cargo test --manifest-path cortex-ar/Cargo.toml
294294
295-
# Run some programs in QEMU
296-
qemu-test:
295+
# Run some programs in QEMU 8 on Linux (but not MPS3-AN536 examples)
296+
qemu-test-linux:
297297
runs-on: ubuntu-24.04
298298
needs: [build-all]
299299
steps:
300-
- run: sudo apt-get -y update && sudo apt-get -y install qemu-system-arm
300+
- name: Install QEMU
301+
run: sudo apt-get -y update && sudo apt-get -y install qemu-system-arm
301302
- name: Checkout
302303
uses: actions/checkout@v4
303-
- run: ./tests.sh
304+
- name: Run tests in QEMU
305+
run: ./tests.sh
306+
307+
# Run some programs in QEMU 9 on Windows (including MPS3-AN536 examples)
308+
qemu-test-windows:
309+
runs-on: windows-latest
310+
needs: [build-all]
311+
steps:
312+
- name: Checkout
313+
uses: actions/checkout@v4
314+
- name: Install QEMU
315+
run: choco install qemu
316+
- name: Run tests in QEMU
317+
shell: bash
318+
run: PATH=${PATH}:/c/Program\ Files/qemu ./tests.sh
319+
320+
# Gather all the above qemu jobs together for the purposes of getting an overall pass-fail
321+
qemu-test-all:
322+
runs-on: ubuntu-24.04
323+
needs: [qemu-test-linux, qemu-test-windows]
324+
steps:
325+
- run: /bin/true
304326

305327
# Gather all the above xxx-all jobs together for the purposes of getting an overall pass-fail
306328
all:
307329
runs-on: ubuntu-24.04
308-
needs: [docs-all, build-all, fmt-all, unit-test, qemu-test] # not gating on clippy-all
330+
needs: [docs-all, build-all, fmt-all, unit-test, qemu-test-all] # not gating on clippy-all
309331
steps:
310332
- run: /bin/true

tests.sh

+14-4
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,32 @@ mkdir -p ./target
2323
versatile_ab_cargo="--manifest-path examples/versatileab/Cargo.toml"
2424
mps3_an536_cargo="--manifest-path examples/mps3-an536/Cargo.toml"
2525

26+
my_diff() {
27+
file_a=$1
28+
file_b=$2
29+
# - Fix Windows path separators (\\) to look like UNIX ones (/) in the QEMU
30+
# output
31+
# - Fix the CRLF line endings in the files on disk, because git adds them to
32+
# text files.
33+
diff <(cat $file_a | tr -d '\r') <(cat $file_b | sed 's~\\\\~/~g')
34+
}
35+
2636
# armv7r-none-eabi tests
2737
for binary in hello registers svc; do
2838
cargo run ${versatile_ab_cargo} --target=armv7r-none-eabi --bin $binary | tee ./target/$binary-armv7r-none-eabi.out
29-
diff ./examples/versatileab/reference/$binary-armv7r-none-eabi.out ./target/$binary-armv7r-none-eabi.out || fail $binary "armv7r-none-eabi"
39+
my_diff ./examples/versatileab/reference/$binary-armv7r-none-eabi.out ./target/$binary-armv7r-none-eabi.out || fail $binary "armv7r-none-eabi"
3040
done
3141

3242
# armv7r-none-eabihf tests
3343
for binary in hello registers svc undef-exception prefetch-exception abt-exception; do
3444
cargo run ${versatile_ab_cargo} --target=armv7r-none-eabihf --bin $binary | tee ./target/$binary-armv7r-none-eabihf.out
35-
diff ./examples/versatileab/reference/$binary-armv7r-none-eabihf.out ./target/$binary-armv7r-none-eabihf.out || fail $binary "armv7r-none-eabihf"
45+
my_diff ./examples/versatileab/reference/$binary-armv7r-none-eabihf.out ./target/$binary-armv7r-none-eabihf.out || fail $binary "armv7r-none-eabihf"
3646
done
3747

3848
# armv7a-none-eabi tests
3949
for binary in hello registers svc undef-exception prefetch-exception abt-exception; do
4050
cargo run ${versatile_ab_cargo} --target=armv7a-none-eabi --bin $binary | tee ./target/$binary-armv7a-none-eabi.out
41-
diff ./examples/versatileab/reference/$binary-armv7a-none-eabi.out ./target/$binary-armv7a-none-eabi.out || fail $binary "armv7a-none-eabi"
51+
my_diff ./examples/versatileab/reference/$binary-armv7a-none-eabi.out ./target/$binary-armv7a-none-eabi.out || fail $binary "armv7a-none-eabi"
4252
done
4353

4454
# These tests only run on QEMU 9 or higher.
@@ -47,7 +57,7 @@ if qemu-system-arm --version | grep "version 9"; then
4757
# armv8r-none-eabihf tests
4858
for binary in hello registers svc gic generic_timer; do
4959
cargo +nightly run ${mps3_an536_cargo} --target=armv8r-none-eabihf --bin $binary --features=gic -Zbuild-std=core | tee ./target/$binary-armv8r-none-eabihf.out
50-
diff ./examples/mps3-an536/reference/$binary-armv8r-none-eabihf.out ./target/$binary-armv8r-none-eabihf.out || fail $binary "armv8r-none-eabihf"
60+
my_diff ./examples/mps3-an536/reference/$binary-armv8r-none-eabihf.out ./target/$binary-armv8r-none-eabihf.out || fail $binary "armv8r-none-eabihf"
5161
done
5262
fi
5363

0 commit comments

Comments
 (0)