mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 14:27:49 +00:00
48 lines
901 B
Rust
48 lines
901 B
Rust
#![no_std]
|
|
#![no_main]
|
|
#![feature(custom_test_frameworks)]
|
|
#![test_runner(blog_os::test_runner)]
|
|
#![reexport_test_harness_main = "test_main"]
|
|
|
|
use blog_os::println;
|
|
use core::panic::PanicInfo;
|
|
|
|
#[unsafe(no_mangle)]
|
|
pub extern "C" fn _start() -> ! {
|
|
println!("Hello World{}", "!");
|
|
|
|
blog_os::init();
|
|
|
|
fn stack_overflow() {
|
|
stack_overflow(); // for each recursion, the return address is pushed
|
|
}
|
|
|
|
// uncomment line below to trigger a stack overflow
|
|
// stack_overflow();
|
|
|
|
#[cfg(test)]
|
|
test_main();
|
|
|
|
println!("It did not crash!");
|
|
loop {}
|
|
}
|
|
|
|
/// This function is called on panic.
|
|
#[cfg(not(test))]
|
|
#[panic_handler]
|
|
fn panic(info: &PanicInfo) -> ! {
|
|
println!("{}", info);
|
|
loop {}
|
|
}
|
|
|
|
#[cfg(test)]
|
|
#[panic_handler]
|
|
fn panic(info: &PanicInfo) -> ! {
|
|
blog_os::test_panic_handler(info)
|
|
}
|
|
|
|
#[test_case]
|
|
fn trivial_assertion() {
|
|
assert_eq!(1, 1);
|
|
}
|