add VIRT_TEST support for qemu exit with exit_code, for CI autotest

This commit is contained in:
Yu Chen 2022-05-15 17:34:24 +08:00
parent a8e8644865
commit f25fe0431c
3 changed files with 94 additions and 6 deletions

View file

@ -57,6 +57,8 @@ pub fn block_current_and_run_next() {
schedule(task_cx_ptr);
}
use crate::board::QEMUExit;
pub fn exit_current_and_run_next(exit_code: i32) {
let task = take_current_task().unwrap();
let mut task_inner = task.inner_exclusive_access();
@ -79,9 +81,11 @@ pub fn exit_current_and_run_next(exit_code: i32) {
exit_code
);
if exit_code != 0 {
crate::sbi::shutdown(255); //255 == -1 for err hint
//crate::sbi::shutdown(255); //255 == -1 for err hint
crate::board::QEMU_EXIT_HANDLE.exit_failure();
} else {
crate::sbi::shutdown(0); //0 for success hint
//crate::sbi::shutdown(0); //0 for success hint
crate::board::QEMU_EXIT_HANDLE.exit_success();
}
}
remove_from_pid2process(pid);