diff --git a/os/Makefile b/os/Makefile index 8be57b7..7f5d801 100644 --- a/os/Makefile +++ b/os/Makefile @@ -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 diff --git a/user/rust/src/bin/r_usertests.rs b/user/rust/src/bin/r_usertests.rs index 9105237..247a3ef 100644 --- a/user/rust/src/bin/r_usertests.rs +++ b/user/rust/src/bin/r_usertests.rs @@ -25,7 +25,7 @@ static tests: &[&str] = &[ "badarg\0", "sleep\0", //"forktree\0", - "spin\0", + //"spin\0", ]; use user_lib::{exec, fork, waitpid}; diff --git a/user/rust/src/bin/r_usertests_full.rs b/user/rust/src/bin/r_usertests_full.rs new file mode 100644 index 0000000..c3868e5 --- /dev/null +++ b/user/rust/src/bin/r_usertests_full.rs @@ -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 +} \ No newline at end of file diff --git a/user/ucore/src/matrix.c b/user/ucore/src/matrix.c index d88d7a2..d9a4e4e 100644 --- a/user/ucore/src/matrix.c +++ b/user/ucore/src/matrix.c @@ -41,7 +41,7 @@ work(unsigned int times) { exit(0); } -const int total = 15; +const int total = 13; int main(void) {