mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-22 17:03:23 +00:00
Add ktest framework
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
d7cc52c615
commit
b8818bb740
@ -1,11 +1,8 @@
|
||||
#![no_std]
|
||||
#![no_main]
|
||||
#![feature(custom_test_frameworks)]
|
||||
// The no_mangle macro need to remove the `forbid(unsafe_code)` macro. The bootloader needs the _start function
|
||||
// to be no mangle so that it can jump into the entry point.
|
||||
// #![forbid(unsafe_code)]
|
||||
#![test_runner(jinux_frame::test_runner)]
|
||||
#![reexport_test_harness_main = "test_main"]
|
||||
extern crate jinux_frame;
|
||||
|
||||
use core::panic::PanicInfo;
|
||||
@ -13,8 +10,6 @@ use jinux_frame::println;
|
||||
|
||||
#[no_mangle]
|
||||
pub fn jinux_main() -> ! {
|
||||
#[cfg(test)]
|
||||
test_main();
|
||||
jinux_frame::init();
|
||||
println!("[kernel] finish init jinux_frame");
|
||||
component::init_all(component::parse_metadata!()).unwrap();
|
||||
@ -22,7 +17,6 @@ pub fn jinux_main() -> ! {
|
||||
jinux_std::run_first_process();
|
||||
}
|
||||
|
||||
#[cfg(not(test))]
|
||||
#[panic_handler]
|
||||
fn panic(info: &PanicInfo) -> ! {
|
||||
use jinux_frame::{exit_qemu, QemuExitCode};
|
||||
@ -31,14 +25,3 @@ fn panic(info: &PanicInfo) -> ! {
|
||||
jinux_frame::panic_handler();
|
||||
exit_qemu(QemuExitCode::Failed);
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[panic_handler]
|
||||
fn panic(info: &PanicInfo) -> ! {
|
||||
jinux_frame::test_panic_handler(info);
|
||||
}
|
||||
|
||||
#[test_case]
|
||||
fn trivial_assertion() {
|
||||
assert_eq!(1, 1);
|
||||
}
|
||||
|
Reference in New Issue
Block a user