26 lines
513 B
Rust
26 lines
513 B
Rust
#![no_std]
|
|
#![no_main]
|
|
|
|
use core::panic::PanicInfo;
|
|
use anos::{QemuExitCode, exit_qemu, serial_println, serial_print};
|
|
|
|
#[panic_handler]
|
|
fn panic(_info: &PanicInfo) -> ! {
|
|
serial_println!("\t[ok]");
|
|
exit_qemu(QemuExitCode::Success);
|
|
loop {}
|
|
}
|
|
|
|
fn should_fail() {
|
|
serial_print!("should_panic::should_fail...");
|
|
assert_eq!(0, 1);
|
|
}
|
|
|
|
#[no_mangle]
|
|
pub extern "C" fn _start() -> ! {
|
|
should_fail();
|
|
serial_println!("[test did not panic]");
|
|
exit_qemu(QemuExitCode::Failed);
|
|
loop {}
|
|
}
|