Skip to content

Commit f9e7b9e

Browse files
Use panic to exit on test mismatch
1 parent 91cbd45 commit f9e7b9e

10 files changed

Lines changed: 14 additions & 18 deletions

examples/mps3-an536/src/bin/abt-exception-a32.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,23 +87,21 @@ unsafe fn data_abort_handler(addr: usize) -> usize {
8787
if addr == expect_fault_at {
8888
println!("caught unaligned_from_a32");
8989
} else {
90-
println!(
90+
panic!(
9191
"Bad fault address {:08x} is not {:08x}",
9292
addr, expect_fault_at
9393
);
94-
semihosting::process::abort();
9594
}
9695

9796
let expect_fault_from = core::ptr::addr_of!(COUNTER) as usize + 1;
9897

9998
if dfar.0 as usize == expect_fault_from {
10099
println!("caught fault on COUNTER");
101100
} else {
102-
println!(
101+
panic!(
103102
"Bad DFAR address {:08x} is not {:08x}",
104103
dfar.0, expect_fault_from
105104
);
106-
semihosting::process::abort();
107105
}
108106

109107
match COUNTER.fetch_add(1, Ordering::Relaxed) {

examples/mps3-an536/src/bin/abt-exception-t32.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,23 +86,21 @@ unsafe fn data_abort_handler(addr: usize) -> usize {
8686
if addr == expect_fault_at {
8787
println!("caught unaligned_from_t32");
8888
} else {
89-
println!(
89+
panic!(
9090
"Bad fault address {:08x} is not {:08x}",
9191
addr, expect_fault_at
9292
);
93-
semihosting::process::abort();
9493
}
9594

9695
let expect_fault_from = core::ptr::addr_of!(COUNTER) as usize + 1;
9796

9897
if dfar.0 as usize == expect_fault_from {
9998
println!("caught fault on COUNTER");
10099
} else {
101-
println!(
100+
panic!(
102101
"Bad DFAR address {:08x} is not {:08x}",
103102
dfar.0, expect_fault_from
104103
);
105-
semihosting::process::abort();
106104
}
107105

108106
match COUNTER.fetch_add(1, Ordering::Relaxed) {

examples/mps3-an536/src/bin/prefetch-exception-a32.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ unsafe fn prefetch_abort_handler(addr: usize) -> usize {
5858
if addr == bkpt_from_a32 as extern "C" fn() as usize {
5959
println!("caught bkpt_from_a32");
6060
} else {
61-
println!(
61+
panic!(
6262
"Bad fault address {:08x} is not {:08x}",
6363
addr, bkpt_from_a32 as extern "C" fn() as usize
6464
);

examples/mps3-an536/src/bin/prefetch-exception-t32.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ unsafe fn prefetch_abort_handler(addr: usize) -> usize {
6161
// machine code.
6262
println!("caught bkpt_from_t32");
6363
} else {
64-
println!(
64+
panic!(
6565
"Bad fault address {:08x} is not {:08x}",
6666
addr, bkpt_from_t32 as extern "C" fn() as usize
6767
);

examples/mps3-an536/src/bin/undef-exception-a32.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ unsafe fn undefined_handler(addr: usize) -> usize {
4949
if addr == udf_from_a32 as extern "C" fn() as usize {
5050
println!("caught udf_from_a32");
5151
} else {
52-
println!(
52+
panic!(
5353
"Bad fault address {:08x} is not {:08x}",
5454
addr, udf_from_a32 as extern "C" fn() as usize
5555
);

examples/mps3-an536/src/bin/undef-exception-t32.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ unsafe fn undefined_handler(addr: usize) -> usize {
5252
// machine code.
5353
println!("caught udf_from_t32");
5454
} else {
55-
println!(
55+
panic!(
5656
"Bad fault address {:08x} is not {:08x}",
5757
addr, udf_from_t32 as extern "C" fn() as usize
5858
);

examples/versatileab/src/bin/abt-exception-a32.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ unsafe fn data_abort_handler(addr: usize) -> usize {
8888
if addr == expect_fault_at {
8989
println!("caught unaligned_from_a32");
9090
} else {
91-
println!(
91+
panic!(
9292
"Bad fault address {:08x} is not {:08x}",
9393
addr, expect_fault_at
9494
);
@@ -99,7 +99,7 @@ unsafe fn data_abort_handler(addr: usize) -> usize {
9999
if dfar.0 as usize == expect_fault_from {
100100
println!("caught fault on COUNTER");
101101
} else {
102-
println!(
102+
panic!(
103103
"Bad DFAR address {:08x} is not {:08x}",
104104
dfar.0, expect_fault_from
105105
);

examples/versatileab/src/bin/abt-exception-t32.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ unsafe fn data_abort_handler(addr: usize) -> usize {
8888
if addr == expect_fault_at {
8989
println!("caught unaligned_from_t32");
9090
} else {
91-
println!(
91+
panic!(
9292
"Bad fault address {:08x} is not {:08x}",
9393
addr, expect_fault_at
9494
);
@@ -99,7 +99,7 @@ unsafe fn data_abort_handler(addr: usize) -> usize {
9999
if dfar.0 as usize == expect_fault_from {
100100
println!("caught fault on COUNTER");
101101
} else {
102-
println!(
102+
panic!(
103103
"Bad DFAR address {:08x} is not {:08x}",
104104
dfar.0, expect_fault_from
105105
);

examples/versatileab/src/bin/undef-exception-a32.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ unsafe fn undefined_handler(addr: usize) -> usize {
5050
if addr == udf_from_a32 as extern "C" fn() as usize {
5151
println!("caught udf_from_a32");
5252
} else {
53-
println!(
53+
panic!(
5454
"Bad fault address {:08x} is not {:08x}",
5555
addr, udf_from_a32 as extern "C" fn() as usize
5656
);

examples/versatileab/src/bin/undef-exception-t32.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ unsafe fn undefined_handler(addr: usize) -> usize {
5353
// machine code.
5454
println!("caught udf_from_t32");
5555
} else {
56-
println!(
56+
panic!(
5757
"Bad fault address {:08x} is not {:08x}",
5858
addr, udf_from_t32 as extern "C" fn() as usize
5959
);

0 commit comments

Comments
 (0)