Skip to content

Commit

Permalink
Update usertests && found deadlock on matrix/qemu platform
Browse files Browse the repository at this point in the history
  • Loading branch information
wyfcyx committed Oct 27, 2020
1 parent 598c0b2 commit 54351d2
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 3 deletions.
3 changes: 2 additions & 1 deletion os/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ USER_BUILD := $(USER_DIR)/build
IMG_FILE := $(USER_BUILD)/riscv64.img
QCOW2_FILE := $(USER_BUILD)/riscv64.qcow2

OBJDUMP := rust-objdump --arch-name=riscv64
#OBJDUMP := rust-objdump --arch-name=riscv64
OBJDUMP := riscv64-unknown-elf-objdump
OBJCOPY := rust-objcopy --binary-architecture=riscv64

.PHONY: doc kernel build clean qemu run env
Expand Down
2 changes: 1 addition & 1 deletion user/rust/src/bin/r_usertests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ static tests: &[&str] = &[
"badarg\0",
"sleep\0",
//"forktree\0",
"spin\0",
//"spin\0",
];

use user_lib::{exec, fork, waitpid};
Expand Down
50 changes: 50 additions & 0 deletions user/rust/src/bin/r_usertests_full.rs
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
}
2 changes: 1 addition & 1 deletion user/ucore/src/matrix.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ work(unsigned int times) {
exit(0);
}

const int total = 15;
const int total = 13;

int
main(void) {
Expand Down

0 comments on commit 54351d2

Please sign in to comment.