diff options
Diffstat (limited to 'kernel/tests/boot.rs')
-rw-r--r-- | kernel/tests/boot.rs | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/kernel/tests/boot.rs b/kernel/tests/boot.rs new file mode 100644 index 0000000..534199a --- /dev/null +++ b/kernel/tests/boot.rs @@ -0,0 +1,38 @@ +#![no_main] +#![feature(compiler_builtins_lib)] +#![feature(custom_test_frameworks)] +#![feature(abi_x86_interrupt)] +#![feature(panic_info_message)] +#![test_runner(kernel::testing::serial_test_runner)] +#![reexport_test_harness_main = "test_main"] +#![no_std] + +use kernel; +use kernel::io::qemu; + +#[no_mangle] +extern "C" fn _start() -> ! { + kernel::init(); + test_main(); + + loop {} +} + +#[test_case] +fn boot() { + assert!(true) +} + +#[test_case] +fn poweroff() { + qemu::exit_qemu(qemu::QemuExitCode::Success); + panic!("Qemu did not exit"); +} + +#[cfg(test)] +#[panic_handler] +#[no_mangle] +extern "C" fn panic_handler(info: &core::panic::PanicInfo) -> ! { + kernel::testing::serial_panic(info); + loop {} +} |