Ktest major improvements #21
|
@ -7,6 +7,11 @@ SECTIONS
|
|||
.text : { *(.text) }
|
||||
.data : { *(.data) }
|
||||
.rodata : { *(.rodata) }
|
||||
.note.ktest : {
|
||||
__ktest_start = .;
|
||||
*(.note.ktest)
|
||||
__ktest_end = .;
|
||||
}
|
||||
.bss : {
|
||||
*(COMMON)
|
||||
*(.bss .bss.*)
|
||||
|
|
|
@ -23,8 +23,11 @@ pub fn kmain(_cmdline: &str, boot_modules: BootModules) -> ! {
|
|||
debug!("Entered kmain");
|
||||
|
||||
#[cfg(feature = "ktest")] {
|
||||
use crate::ktest::test_main;
|
||||
debug!("Running tests");
|
||||
use {
|
||||
crate::ktest::test_main,
|
||||
log::info,
|
||||
};
|
||||
info!("Running tests");
|
||||
test_main();
|
||||
|
||||
loop {}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use {
|
||||
alloc::string::String,
|
||||
log::debug,
|
||||
log::{info, error},
|
||||
};
|
||||
|
||||
pub use ktest_macro::*;
|
||||
|
@ -15,6 +15,7 @@ extern "C" {
|
|||
// TODO: Implement ktest for arm and riscv (Later problems, see below)
|
||||
// Allow for arch specific tests (Leave for now)
|
||||
// Should panic tests
|
||||
// Test specific panic handler
|
||||
pub fn test_main() {
|
||||
unsafe {
|
||||
let mut current_test = &__ktest_start as *const fn() -> Result<String, String>;
|
||||
|
@ -29,11 +30,11 @@ pub fn test_main() {
|
|||
let test_name = test_fn();
|
||||
match test_name {
|
||||
Ok(name) => {
|
||||
debug!("Test: {} passed", name);
|
||||
info!("Test: {} passed", name);
|
||||
pass += 1;
|
||||
},
|
||||
Err(name) => {
|
||||
debug!("Test: {} failed", name);
|
||||
error!("Test: {} failed", name);
|
||||
fail += 1;
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +42,7 @@ pub fn test_main() {
|
|||
current_test = current_test.add(1);
|
||||
}
|
||||
|
||||
debug!("{}/{} tests passed", pass, pass + fail);
|
||||
info!("{}/{} tests passed", pass, pass + fail);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue