forked from rcore-os/rCore-Tutorial
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update usertests && found deadlock on matrix/qemu platform
- Loading branch information
Showing
4 changed files
with
54 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#![no_std] | ||
#![no_main] | ||
|
||
#[macro_use] | ||
extern crate user_lib; | ||
|
||
static tests: &[&str] = &[ | ||
"r_fantastic_text\0", | ||
"r_forktest\0", | ||
"r_forktest2\0", | ||
"r_matrix\0", | ||
"r_matrix_g\0", | ||
"r_hello_world\0", | ||
"r_sleep\0", | ||
"r_stack_overflow\0", | ||
"hello\0", | ||
"forktest\0", | ||
"divzero\0", | ||
"testbss\0", | ||
"faultread\0", | ||
"faultreadkernel\0", | ||
"exit\0", | ||
"matrix\0", | ||
"yield\0", | ||
"badarg\0", | ||
"sleep\0", | ||
"forktree\0", | ||
"spin\0", | ||
]; | ||
|
||
use user_lib::{exec, fork, waitpid}; | ||
|
||
#[no_mangle] | ||
pub fn main() -> i32 { | ||
for test in tests { | ||
println!("Usertests: Running {}", test); | ||
let pid = fork(); | ||
if pid == 0 { | ||
exec(*test as *const _ as *const u8); | ||
panic!("unreachable!"); | ||
} else { | ||
let mut xstate: i32 = Default::default(); | ||
let wait_pid = waitpid(pid as usize, &mut xstate); | ||
assert_eq!(pid, wait_pid); | ||
println!("Usertests: Test {} in Process {} exited with code {}", test, pid, xstate); | ||
} | ||
} | ||
println!("Usertests passed!"); | ||
0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,7 +41,7 @@ work(unsigned int times) { | |
exit(0); | ||
} | ||
|
||
const int total = 15; | ||
const int total = 13; | ||
|
||
int | ||
main(void) { | ||
|