Implement code for integration test post

This commit is contained in:
Philipp Oppermann
2018-06-12 19:25:53 +02:00
parent 40eb19b613
commit 8b5be6ebc0
7 changed files with 125 additions and 12 deletions

View File

@@ -0,0 +1,37 @@
#![feature(panic_implementation)] // required for defining the panic handler
#![feature(const_fn)]
#![no_std] // don't link the Rust standard library
#![cfg_attr(not(test), no_main)] // disable all Rust-level entry points
// add the library as dependency (same crate name as executable)
#[macro_use]
extern crate blog_os;
#[cfg(not(test))]
use core::panic::PanicInfo;
use blog_os::exit_qemu;
/// This function is the entry point, since the linker looks for a function
/// named `_start_` by default.
#[cfg(not(test))]
#[no_mangle] // don't mangle the name of this function
pub extern "C" fn _start() -> ! {
serial_println!("ok");
unsafe { exit_qemu(); }
loop {}
}
/// This function is called on panic.
#[cfg(not(test))]
#[panic_implementation]
#[no_mangle]
pub fn panic(info: &PanicInfo) -> ! {
serial_println!("failed");
serial_println!("{}", info);
unsafe { exit_qemu(); }
loop {}
}