Commit 3f22a699 authored by shuailiang's avatar shuailiang
Browse files

add test array

parent d133d28a
No related merge requests found
Showing with 45 additions and 6 deletions
+45 -6
......@@ -8,6 +8,42 @@
#include "xv6-user/user.h"
char *argv[] = { 0 };
char *tests[] = {
"brk",
"chdir",
"close",
"dup",
"exit",
"fork",
"fstat",
"getcwd",
"getpid",
"open",
"pipe",
"read",
"wait",
"write",
"sleep",
"pipe",
"dup",
"dup2",
"openat",
"getdents",
"unlink",
"clone",
"execve",
"waitpid",
"gettimeofday",
"getppid",
"yield",
"mmap",
"munmap",
"times",
"uname",
"mkdir_",
};
int counts = sizeof(tests) / sizeof((tests)[0]);
int
main(void)
......@@ -22,8 +58,9 @@ main(void)
dup(0); // stdout
dup(0); // stderr
for(;;){
printf("init: starting sh\n");
for(int i = 0;i < counts;i++) {
// for(int i = 0;i < 1;i++) {
printf("init: starting init\n");
pid = fork();
if(pid < 0){
printf("init: fork failed\n");
......@@ -31,8 +68,9 @@ main(void)
}
if(pid == 0){
// exec("sh", argv);
exec("riscv64/exit", argv);
printf("init: exec sh failed\n");
exec(tests[i], argv);
// exec("riscv64/exit", argv);
printf("init: exec %s failed\n",tests[i]);
exit(1);
}
for(;;){
......@@ -41,8 +79,6 @@ main(void)
wpid = wait((int *) 0);
if(wpid == pid){
// the shell exited; restart it.
printf("\n--------qemu will shut down---------\n");
shutdown();
break;
} else if(wpid < 0){
printf("init: wait returned an error\n");
......@@ -51,5 +87,8 @@ main(void)
// it was a parentless process; do nothing.
}
}
}
printf("\n--------qemu will shut down---------\n");
shutdown();
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment