RustForge

rust-kernel

Rustbelt: a hobby x86_64 kernel written in Rust

rust-kernel / tests / basic_boot.rs
573 bytes ยท raw
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
//! Boots with nothing initialised and checks printing works.
#![no_std]
#![no_main]
#![feature(custom_test_frameworks)]
#![test_runner(rustbelt::test_runner)]
#![reexport_test_harness_main = "test_main"]

use core::panic::PanicInfo;
use rustbelt::println;

#[unsafe(no_mangle)] // a plain `_start`: we don't need BootInfo here
pub extern "C" fn _start() -> ! {
    test_main();
    rustbelt::hlt_loop();
}

#[panic_handler]
fn panic(info: &PanicInfo) -> ! {
    rustbelt::test_panic_handler(info)
}

#[test_case]
fn test_println() {
    println!("test_println output");
}