WIP integration test

This commit is contained in:
Greg Shuflin 2022-04-03 21:16:33 -07:00
parent 7cac67b0fc
commit a15d7d820f
4 changed files with 42 additions and 3 deletions

16
src/lib.rs Normal file
View File

@ -0,0 +1,16 @@
#![no_std]
#![cfg_attr(test, no_main)]
#![feature(custom_test_frameworks)]
#![test_runner(crate::test_utils::test_runner)]
#![reexport_test_harness_main = "test_main"]
pub mod test_utils;
pub mod serial;
pub mod vga_buffer;
#[cfg(test)]
#[no_mangle]
pub extern "C" fn _start() {
test_main();
loop {}
}

View File

@ -20,8 +20,8 @@ fn panic(info: &core::panic::PanicInfo) -> ! {
#[no_mangle]
pub extern "C" fn _start() -> ! {
#[cfg(test)]
test_main();
// #[cfg(test)]
// test_main();
println!("Gamarjoba, munde!");
loop {}

View File

@ -3,7 +3,7 @@
use core::panic::PanicInfo;
#[panic_handler]
fn panic(info: &PanicInfo) -> ! {
pub fn panic(info: &PanicInfo) -> ! {
serial_println!("[failed]\n");
serial_println!("Error: {}", info);
exit_qemu(QemuExitCode::Failed);

23
tests/basic_boot.rs Normal file
View File

@ -0,0 +1,23 @@
#![no_std]
#![no_main]
#![feature(custom_test_frameworks)]
#![test_runner(crate::test_utils::test_runner)]
#![reexport_test_harness_main = "test_main"]
use core::panic::PanicInfo;
#[no_mangle] // don't mangle the name of this function
pub extern "C" fn _start() -> ! {
test_main();
loop {}
}
fn test_runner(tests: &[&dyn Fn()]) {
unimplemented!();
}
#[panic_handler]
fn panic(info: &PanicInfo) -> ! {
loop {}
}