mirror of
https://github.com/rcore-os/rCore-Tutorial-v3.git
synced 2024-11-23 01:46:24 +04:00
Fix other usertests: xstate -> exit_code
This commit is contained in:
parent
5e798029b0
commit
f1e772a984
@ -22,12 +22,12 @@ pub fn main() -> i32 {
|
||||
}
|
||||
}
|
||||
|
||||
let mut xstate: i32 = 0;
|
||||
let mut exit_code: i32 = 0;
|
||||
for _ in 0..NUM {
|
||||
assert!(wait(&mut xstate) > 0);
|
||||
assert_eq!(xstate, 0);
|
||||
assert!(wait(&mut exit_code) > 0);
|
||||
assert_eq!(exit_code, 0);
|
||||
}
|
||||
assert!(wait(&mut xstate) < 0);
|
||||
assert!(wait(&mut exit_code) < 0);
|
||||
println!("forktest2 test passed!");
|
||||
0
|
||||
}
|
@ -18,11 +18,11 @@ pub fn main() -> i32 {
|
||||
100
|
||||
} else {
|
||||
// parent process
|
||||
let mut xstate: i32 = 0;
|
||||
let mut exit_code: i32 = 0;
|
||||
println!("ready waiting on parent process!");
|
||||
assert_eq!(pid, wait(&mut xstate));
|
||||
assert_eq!(xstate, 100);
|
||||
println!("child process pid = {}, exit code = {}", pid, xstate);
|
||||
assert_eq!(pid, wait(&mut exit_code));
|
||||
assert_eq!(exit_code, 100);
|
||||
println!("child process pid = {}, exit code = {}", pid, exit_code);
|
||||
0
|
||||
}
|
||||
}
|
@ -56,13 +56,13 @@ pub fn main() -> i32 {
|
||||
|
||||
println!("fork ok.");
|
||||
|
||||
let mut xstate: i32 = 0;
|
||||
let mut exit_code: i32 = 0;
|
||||
for _ in 0..NUM {
|
||||
if wait(&mut xstate) < 0 {
|
||||
if wait(&mut exit_code) < 0 {
|
||||
panic!("wait failed.");
|
||||
}
|
||||
}
|
||||
assert!(wait(&mut xstate) < 0);
|
||||
assert!(wait(&mut exit_code) < 0);
|
||||
println!("matrix passed.");
|
||||
0
|
||||
}
|
@ -19,11 +19,11 @@ fn sleepy() {
|
||||
pub fn main() -> i32 {
|
||||
let current_time = get_time();
|
||||
let pid = fork();
|
||||
let mut xstate: i32 = 0;
|
||||
let mut exit_code: i32 = 0;
|
||||
if pid == 0 {
|
||||
sleepy();
|
||||
}
|
||||
assert!(waitpid(pid as usize, &mut xstate) == pid && xstate == 0);
|
||||
assert!(waitpid(pid as usize, &mut exit_code) == pid && exit_code == 0);
|
||||
println!("use {} msecs.", get_time() - current_time);
|
||||
println!("sleep pass.");
|
||||
0
|
||||
|
@ -29,10 +29,10 @@ pub fn main() -> i32 {
|
||||
exec(*test);
|
||||
panic!("unreachable!");
|
||||
} else {
|
||||
let mut xstate: i32 = Default::default();
|
||||
let wait_pid = waitpid(pid as usize, &mut xstate);
|
||||
let mut exit_code: i32 = Default::default();
|
||||
let wait_pid = waitpid(pid as usize, &mut exit_code);
|
||||
assert_eq!(pid, wait_pid);
|
||||
println!("\x1b[32mUsertests: Test {} in Process {} exited with code {}\x1b[0m", test, pid, xstate);
|
||||
println!("\x1b[32mUsertests: Test {} in Process {} exited with code {}\x1b[0m", test, pid, exit_code);
|
||||
}
|
||||
}
|
||||
println!("Usertests passed!");
|
||||
|
Loading…
Reference in New Issue
Block a user