Fix warnings in tests

This commit is contained in:
guillaume didier 2019-11-13 14:26:39 +01:00
parent e5efe96ffb
commit 21224d62e2
5 changed files with 29 additions and 20 deletions

View File

@ -8,7 +8,17 @@
use core::panic::PanicInfo;
#[cfg(test)]
use vga_buffer::print;
#[cfg(test)]
use polling_serial::serial_print;
use polling_serial::serial_println;
use vga_buffer::println;
use x86_64::instructions::bochs_breakpoint;

View File

@ -8,16 +8,25 @@
#![reexport_test_harness_main = "test_main"]
use polling_serial::serial_println;
use vga_buffer::{println, set_colors, Color, ForegroundColor};
#[cfg(test)]
use polling_serial::serial_print;
use vga_buffer::println;
use core::panic::PanicInfo;
use vga_buffer; // required for custom panic handler
use dendrobates_tinctoreus_azureus::hlt_loop;
use x86_64;
use bootloader::{entry_point, BootInfo};
#[cfg(not(test))]
use dendrobates_tinctoreus_azureus::hlt_loop;
#[cfg(not(test))]
use vga_buffer::{set_colors, Color, ForegroundColor};
// Custom panic handler, required for freestanding program
#[cfg(not(test))]
#[panic_handler]
@ -32,7 +41,7 @@ fn panic(info: &PanicInfo) -> ! {
entry_point!(kernel_main);
// Kernel entry point
fn kernel_main(boot_info: &'static BootInfo) -> ! {
fn kernel_main(_boot_info: &'static BootInfo) -> ! {
// TODO: Take care of cpuid stuff and set-up all floating point exetnsions
// TODO: We may also need to enable debug registers ?
@ -103,7 +112,7 @@ fn float_test() {
rf,
vf
);
if (rf == vf) {
if rf == vf {
serial_println!("[ok]");
} else {
serial_println!("[fail]");
@ -115,7 +124,7 @@ fn float_test() {
rd,
vd
);
if (rd == vd) {
if rd == vd {
serial_println!("[ok]");
} else {
serial_println!("[fail]");
@ -124,12 +133,3 @@ fn float_test() {
assert_eq!(rd, vd);
serial_println!("Testing float computations... [ok]");
}
//#[test_case]
//fn failing_assertion() {
// print!("trivial assertion... ");
// serial_print!("trivial assertion... ");
// assert_eq!(1, 1);
// println!("[ok]");
// serial_println!("[ok]");
//}

View File

@ -6,7 +6,7 @@
use core::panic::PanicInfo;
use polling_serial::{serial_print, serial_println};
use vga_buffer::{print, println};
use vga_buffer::println;
use bootloader::{entry_point, BootInfo};

View File

@ -16,7 +16,6 @@ fn test_kernel_main(_boot_info: &'static BootInfo) -> ! {
should_fail();
serial_println!("[test did not panic]");
exit_qemu(QemuExitCode::Failed);
loop {}
}
fn should_fail() {
@ -28,5 +27,5 @@ fn should_fail() {
fn panic(_info: &PanicInfo) -> ! {
serial_println!("[ok]");
exit_qemu(QemuExitCode::Success);
loop {}
}

View File

@ -16,7 +16,7 @@
use core::panic::PanicInfo;
use lazy_static::lazy_static;
use polling_serial::{serial_print, serial_println};
use vga_buffer::{print, println};
use vga_buffer::{println};
use volatile::Volatile;
use x86_64::structures::idt::{InterruptDescriptorTable, InterruptStackFrame};
@ -87,7 +87,7 @@ fn test_intr() {
rf,
vf
);
if (rf == vf) {
if rf == vf {
serial_println!("[ok]");
} else {
serial_println!("[fail]");
@ -99,7 +99,7 @@ fn test_intr() {
rd,
vd
);
if (rd == vd) {
if rd == vd {
serial_println!("[ok]");
} else {
serial_println!("[fail]");