Ktest major improvements #21

Open
funky wants to merge 4 commits from funky/ableos:ktest into master
2 changed files with 9 additions and 6 deletions
Showing only changes of commit d52f14ee1f - Show all commits

View file

@ -23,11 +23,11 @@ pub fn kmain(_cmdline: &str, boot_modules: BootModules) -> ! {
debug!("Entered kmain");
#[cfg(feature = "ktest")] {
use crate::ktest;
debug!("TESTING");
ktest::test_main();
use crate::ktest::test_main;
debug!("Running tests");
test_main();
loop {};
loop {}
}
// let kcmd = build_cmd("Kernel Command Line", cmdline);

View file

@ -5,6 +5,8 @@ use {
pub use ktest_macro::*;
#[allow(improper_ctypes)]
extern "C" {
static __ktest_start: fn() -> Result<String, String>;
static __ktest_end: fn() -> Result<String, String>;
@ -12,6 +14,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
pub fn test_main() {
unsafe {
let mut current_test = &__ktest_start as *const fn() -> Result<String, String>;
@ -29,8 +32,8 @@ pub fn test_main() {
debug!("Test: {} passed", name);
pass += 1;
},
Err(ename) => {
debug!("Test: {} failed", ename);
Err(name) => {
debug!("Test: {} failed", name);
fail += 1;
}
}