Use entry_point! in all tests*

This commit is contained in:
guillaume didier 2019-11-13 14:12:28 +01:00
parent 6da5f5c956
commit e5efe96ffb
5 changed files with 42 additions and 10 deletions

View File

@ -65,9 +65,17 @@ pub fn hlt_loop() -> ! {
}
}
#[cfg(test)]
#[no_mangle]
pub extern "C" fn _start() -> ! {
use bootloader::{entry_point, BootInfo};
#[cfg(test)]
entry_point!(test_kernel_main);
/// Entry point for `cargo xtest`
#[cfg(test)]
fn test_kernel_main(_boot_info: &'static BootInfo) -> ! {
init();
test_main();
loop {}
}

View File

@ -8,8 +8,15 @@ use core::panic::PanicInfo;
use polling_serial::{serial_print, serial_println};
use vga_buffer::{print, println};
#[no_mangle] // don't mangle the name of this function
pub extern "C" fn _start() -> ! {
use bootloader::{entry_point, BootInfo};
entry_point!(test_kernel_main);
/// Entry point for `cargo xtest`
fn test_kernel_main(_boot_info: &'static BootInfo) -> ! {
dendrobates_tinctoreus_azureus::init();
test_main();
loop {}

View File

@ -5,8 +5,14 @@ use core::panic::PanicInfo;
use dendrobates_tinctoreus_azureus::{exit_qemu, QemuExitCode};
use polling_serial::{serial_print, serial_println};
#[no_mangle]
pub extern "C" fn _start() -> ! {
use bootloader::{entry_point, BootInfo};
entry_point!(test_kernel_main);
/// Entry point for `cargo xtest`
fn test_kernel_main(_boot_info: &'static BootInfo) -> ! {
dendrobates_tinctoreus_azureus::init();
should_fail();
serial_println!("[test did not panic]");
exit_qemu(QemuExitCode::Failed);

View File

@ -20,8 +20,14 @@ use vga_buffer::{print, println};
use volatile::Volatile;
use x86_64::structures::idt::{InterruptDescriptorTable, InterruptStackFrame};
#[no_mangle] // don't mangle the name of this function
pub extern "C" fn _start() -> ! {
use bootloader::{entry_point, BootInfo};
entry_point!(test_kernel_main);
/// Entry point for `cargo xtest`
fn test_kernel_main(_boot_info: &'static BootInfo) -> ! {
dendrobates_tinctoreus_azureus::init();
test_main();
loop {}

View File

@ -9,8 +9,13 @@ use core::panic::PanicInfo;
use dendrobates_tinctoreus_azureus::{exit_qemu, QemuExitCode};
use polling_serial::{serial_print, serial_println};
#[no_mangle]
pub extern "C" fn _start() -> ! {
use bootloader::{entry_point, BootInfo};
entry_point!(test_kernel_main);
/// Entry point for `cargo xtest`
fn test_kernel_main(_boot_info: &'static BootInfo) -> ! {
serial_print!("stack_overflow... ");
dendrobates_tinctoreus_azureus::gdt::init();