summaryrefslogtreecommitdiff
path: root/kernel/tests/boot.rs
blob: c6c0de020dd8d1db576a2824d159484234d872ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#![no_main]
#![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"]
#![allow(unreachable_code)]
#![no_std]

use kernel;
use kernel::io::qemu;

#[no_mangle]
extern "C" fn _start() -> ! {
    kernel::init();
    test_main();

    #[allow(clippy::empty_loop)]
    loop {}
}

#[test_case]
fn boot() {
    assert!(true)
}

#[test_case]
fn poweroff() {
    qemu::exit_qemu(qemu::QemuExitCode::Success);
    loop {}
    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);
    #[allow(clippy::empty_loop)]
    loop {}
}