@@ -23,22 +23,32 @@ mkdir -p ./target
23
23
versatile_ab_cargo=" --manifest-path examples/versatileab/Cargo.toml"
24
24
mps3_an536_cargo=" --manifest-path examples/mps3-an536/Cargo.toml"
25
25
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
+
26
36
# armv7r-none-eabi tests
27
37
for binary in hello registers svc; do
28
38
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"
30
40
done
31
41
32
42
# armv7r-none-eabihf tests
33
43
for binary in hello registers svc undef-exception prefetch-exception abt-exception; do
34
44
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"
36
46
done
37
47
38
48
# armv7a-none-eabi tests
39
49
for binary in hello registers svc undef-exception prefetch-exception abt-exception; do
40
50
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"
42
52
done
43
53
44
54
# These tests only run on QEMU 9 or higher.
@@ -47,7 +57,7 @@ if qemu-system-arm --version | grep "version 9"; then
47
57
# armv8r-none-eabihf tests
48
58
for binary in hello registers svc gic generic_timer; do
49
59
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"
51
61
done
52
62
fi
53
63
0 commit comments