Ktest: minor cleanup

This commit is contained in:
funky 2024-11-24 19:27:08 +11:00
parent 4cd7a76ee7
commit d52f14ee1f
2 changed files with 9 additions and 6 deletions

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;
}
}