feat: CI run tests

This commit is contained in:
DeathWish5 2022-05-13 18:19:17 +08:00 committed by Yu Chen
parent 8d6a1bcc79
commit 040bba5f40
9 changed files with 81 additions and 34 deletions

View file

@ -17,7 +17,7 @@ use process::ProcessControlBlock;
use switch::__switch;
pub use context::TaskContext;
pub use id::{kstack_alloc, pid_alloc, KernelStack, PidHandle};
pub use id::{kstack_alloc, pid_alloc, KernelStack, PidHandle, IDLE_PID};
pub use manager::{add_task, pid2process, remove_from_pid2process};
pub use processor::{
current_kstack_top, current_process, current_task, current_trap_cx, current_trap_cx_user_va,
@ -26,6 +26,7 @@ pub use processor::{
pub use signal::SignalFlags;
pub use task::{TaskControlBlock, TaskStatus};
pub fn suspend_current_and_run_next() {
// There must be an application running.
let task = take_current_task().unwrap();
@ -72,7 +73,12 @@ pub fn exit_current_and_run_next(exit_code: i32) {
// however, if this is the main thread of current process
// the process should terminate at once
if tid == 0 {
remove_from_pid2process(process.getpid());
let pid = process.getpid();
if pid == IDLE_PID {
println!("[kernel] Idle process exit ...");
crate::sbi::shutdown();
}
remove_from_pid2process(pid);
let mut process_inner = process.inner_exclusive_access();
// mark this process as a zombie process
process_inner.is_zombie = true;