Split test failure printing in two parts
Due to static buffer size the panic info might not fit. We still want to print [failed] message in this case though.
This commit is contained in:
parent
79baa20eb6
commit
0def5a4687
|
@ -1,6 +1,7 @@
|
|||
#[cfg(not(test))]
|
||||
#[panic_handler]
|
||||
fn panicked(info: &core::panic::PanicInfo) -> ! {
|
||||
// @todo This may fail to print if the panic message is too long for local print buffer.
|
||||
crate::println!("{}", info);
|
||||
crate::endless_sleep()
|
||||
}
|
||||
|
@ -8,6 +9,8 @@ fn panicked(info: &core::panic::PanicInfo) -> ! {
|
|||
#[cfg(test)]
|
||||
#[panic_handler]
|
||||
fn panicked(info: &core::panic::PanicInfo) -> ! {
|
||||
crate::println!("[failed]\nError: {}\n", info);
|
||||
crate::println!("\n[failed]\n");
|
||||
// @todo This may fail to print if the panic message is too long for local print buffer.
|
||||
crate::println!("\nError: {}\n", info);
|
||||
crate::qemu::semihosting::exit_failure()
|
||||
}
|
||||
|
|
|
@ -12,8 +12,8 @@ pub fn test_runner(tests: &[&dyn Fn()]) {
|
|||
println!("Running {} tests", tests.len());
|
||||
for test in tests {
|
||||
test();
|
||||
println!("[ok]");
|
||||
println!("\n[ok]\n");
|
||||
}
|
||||
println!("[success]");
|
||||
println!("\n[success]\n");
|
||||
qemu::semihosting::exit_success();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue