Fix warnings in tests
This commit is contained in:
parent
e5efe96ffb
commit
21224d62e2
10
src/lib.rs
10
src/lib.rs
@ -8,7 +8,17 @@
|
|||||||
|
|
||||||
use core::panic::PanicInfo;
|
use core::panic::PanicInfo;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
use vga_buffer::print;
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
use polling_serial::serial_print;
|
||||||
|
|
||||||
use polling_serial::serial_println;
|
use polling_serial::serial_println;
|
||||||
|
|
||||||
|
|
||||||
use vga_buffer::println;
|
use vga_buffer::println;
|
||||||
use x86_64::instructions::bochs_breakpoint;
|
use x86_64::instructions::bochs_breakpoint;
|
||||||
|
|
||||||
|
28
src/main.rs
28
src/main.rs
@ -8,16 +8,25 @@
|
|||||||
#![reexport_test_harness_main = "test_main"]
|
#![reexport_test_harness_main = "test_main"]
|
||||||
|
|
||||||
use polling_serial::serial_println;
|
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 core::panic::PanicInfo;
|
||||||
use vga_buffer; // required for custom panic handler
|
use vga_buffer; // required for custom panic handler
|
||||||
|
|
||||||
use dendrobates_tinctoreus_azureus::hlt_loop;
|
|
||||||
use x86_64;
|
use x86_64;
|
||||||
|
|
||||||
use bootloader::{entry_point, BootInfo};
|
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
|
// Custom panic handler, required for freestanding program
|
||||||
#[cfg(not(test))]
|
#[cfg(not(test))]
|
||||||
#[panic_handler]
|
#[panic_handler]
|
||||||
@ -32,7 +41,7 @@ fn panic(info: &PanicInfo) -> ! {
|
|||||||
entry_point!(kernel_main);
|
entry_point!(kernel_main);
|
||||||
|
|
||||||
// Kernel entry point
|
// 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: Take care of cpuid stuff and set-up all floating point exetnsions
|
||||||
// TODO: We may also need to enable debug registers ?
|
// TODO: We may also need to enable debug registers ?
|
||||||
|
|
||||||
@ -103,7 +112,7 @@ fn float_test() {
|
|||||||
rf,
|
rf,
|
||||||
vf
|
vf
|
||||||
);
|
);
|
||||||
if (rf == vf) {
|
if rf == vf {
|
||||||
serial_println!("[ok]");
|
serial_println!("[ok]");
|
||||||
} else {
|
} else {
|
||||||
serial_println!("[fail]");
|
serial_println!("[fail]");
|
||||||
@ -115,7 +124,7 @@ fn float_test() {
|
|||||||
rd,
|
rd,
|
||||||
vd
|
vd
|
||||||
);
|
);
|
||||||
if (rd == vd) {
|
if rd == vd {
|
||||||
serial_println!("[ok]");
|
serial_println!("[ok]");
|
||||||
} else {
|
} else {
|
||||||
serial_println!("[fail]");
|
serial_println!("[fail]");
|
||||||
@ -124,12 +133,3 @@ fn float_test() {
|
|||||||
assert_eq!(rd, vd);
|
assert_eq!(rd, vd);
|
||||||
serial_println!("Testing float computations... [ok]");
|
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]");
|
|
||||||
//}
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
use core::panic::PanicInfo;
|
use core::panic::PanicInfo;
|
||||||
use polling_serial::{serial_print, serial_println};
|
use polling_serial::{serial_print, serial_println};
|
||||||
use vga_buffer::{print, println};
|
use vga_buffer::println;
|
||||||
|
|
||||||
|
|
||||||
use bootloader::{entry_point, BootInfo};
|
use bootloader::{entry_point, BootInfo};
|
||||||
|
@ -16,7 +16,6 @@ fn test_kernel_main(_boot_info: &'static BootInfo) -> ! {
|
|||||||
should_fail();
|
should_fail();
|
||||||
serial_println!("[test did not panic]");
|
serial_println!("[test did not panic]");
|
||||||
exit_qemu(QemuExitCode::Failed);
|
exit_qemu(QemuExitCode::Failed);
|
||||||
loop {}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn should_fail() {
|
fn should_fail() {
|
||||||
@ -28,5 +27,5 @@ fn should_fail() {
|
|||||||
fn panic(_info: &PanicInfo) -> ! {
|
fn panic(_info: &PanicInfo) -> ! {
|
||||||
serial_println!("[ok]");
|
serial_println!("[ok]");
|
||||||
exit_qemu(QemuExitCode::Success);
|
exit_qemu(QemuExitCode::Success);
|
||||||
loop {}
|
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
use core::panic::PanicInfo;
|
use core::panic::PanicInfo;
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use polling_serial::{serial_print, serial_println};
|
use polling_serial::{serial_print, serial_println};
|
||||||
use vga_buffer::{print, println};
|
use vga_buffer::{println};
|
||||||
use volatile::Volatile;
|
use volatile::Volatile;
|
||||||
use x86_64::structures::idt::{InterruptDescriptorTable, InterruptStackFrame};
|
use x86_64::structures::idt::{InterruptDescriptorTable, InterruptStackFrame};
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ fn test_intr() {
|
|||||||
rf,
|
rf,
|
||||||
vf
|
vf
|
||||||
);
|
);
|
||||||
if (rf == vf) {
|
if rf == vf {
|
||||||
serial_println!("[ok]");
|
serial_println!("[ok]");
|
||||||
} else {
|
} else {
|
||||||
serial_println!("[fail]");
|
serial_println!("[fail]");
|
||||||
@ -99,7 +99,7 @@ fn test_intr() {
|
|||||||
rd,
|
rd,
|
||||||
vd
|
vd
|
||||||
);
|
);
|
||||||
if (rd == vd) {
|
if rd == vd {
|
||||||
serial_println!("[ok]");
|
serial_println!("[ok]");
|
||||||
} else {
|
} else {
|
||||||
serial_println!("[fail]");
|
serial_println!("[fail]");
|
||||||
|
Loading…
Reference in New Issue
Block a user