Build usertests

上级 7281e73a
...@@ -76,6 +76,7 @@ ULIB := $(addprefix $(O)/, $(ULIB)) ...@@ -76,6 +76,7 @@ ULIB := $(addprefix $(O)/, $(ULIB))
UPROGS= \ UPROGS= \
_cat \ _cat \
_echo \
_init \ _init \
_forkexectree \ _forkexectree \
_forkexecbench \ _forkexecbench \
...@@ -85,7 +86,8 @@ UPROGS= \ ...@@ -85,7 +86,8 @@ UPROGS= \
_maptest \ _maptest \
_sh \ _sh \
_thrtest \ _thrtest \
_halt _halt \
_usertests
UPROGS := $(addprefix $(O)/, $(UPROGS)) UPROGS := $(addprefix $(O)/, $(UPROGS))
all: $(O)/kernel all: $(O)/kernel
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
#include "fcntl.h" #include "fcntl.h"
#include "syscall.h" #include "syscall.h"
#include "traps.h" #include "traps.h"
#include "mtrace.h"
char buf[2048]; char buf[2048];
char name[3]; char name[3];
...@@ -663,7 +662,7 @@ concreate(void) ...@@ -663,7 +662,7 @@ concreate(void)
int i, pid, n, fd; int i, pid, n, fd;
char fa[40]; char fa[40];
struct { struct {
ushort inum; u16 inum;
char name[14]; char name[14];
} de; } de;
...@@ -1240,7 +1239,7 @@ sbrktest(void) ...@@ -1240,7 +1239,7 @@ sbrktest(void)
{ {
int fds[2], pid, pids[32], ppid; int fds[2], pid, pids[32], ppid;
char *a, *b, *c, *lastaddr, *oldbrk, *p, scratch; char *a, *b, *c, *lastaddr, *oldbrk, *p, scratch;
uint amt; uptr amt;
printf(stdout, "sbrk test\n"); printf(stdout, "sbrk test\n");
oldbrk = sbrk(0); oldbrk = sbrk(0);
...@@ -1275,7 +1274,7 @@ sbrktest(void) ...@@ -1275,7 +1274,7 @@ sbrktest(void)
// can one allocate the full 640K? // can one allocate the full 640K?
// less a stack page and an empty page at the top. // less a stack page and an empty page at the top.
a = sbrk(0); a = sbrk(0);
amt = (632 * 1024) - (uint)a; amt = (632 * 1024) - (uptr)a;
p = sbrk(amt); p = sbrk(amt);
if(p != a){ if(p != a){
printf(stdout, "sbrk test failed 632K test, p %x a %x\n", p, a); printf(stdout, "sbrk test failed 632K test, p %x a %x\n", p, a);
...@@ -1351,7 +1350,7 @@ sbrktest(void) ...@@ -1351,7 +1350,7 @@ sbrktest(void)
for(i = 0; i < sizeof(pids)/sizeof(pids[0]); i++){ for(i = 0; i < sizeof(pids)/sizeof(pids[0]); i++){
if((pids[i] = fork(0)) == 0){ if((pids[i] = fork(0)) == 0){
// allocate the full 632K // allocate the full 632K
sbrk((632 * 1024) - (uint)sbrk(0)); sbrk((632 * 1024) - (uptr)sbrk(0));
write(fds[1], "x", 1); write(fds[1], "x", 1);
// sit around until killed // sit around until killed
for(;;) sleep(1000); for(;;) sleep(1000);
...@@ -1396,12 +1395,12 @@ void ...@@ -1396,12 +1395,12 @@ void
validatetest(void) validatetest(void)
{ {
int hi, pid; int hi, pid;
uint p; uptr p;
printf(stdout, "validate test\n"); printf(stdout, "validate test\n");
hi = 1100*1024; hi = 1100*1024;
for(p = 0; p <= (uint)hi; p += 4096){ for(p = 0; p <= (uptr)hi; p += 4096){
if((pid = fork(0)) == 0){ if((pid = fork(0)) == 0){
// try to crash the kernel by passing in a badly placed integer // try to crash the kernel by passing in a badly placed integer
validateint((int*)p); validateint((int*)p);
...@@ -1444,9 +1443,8 @@ bsstest(void) ...@@ -1444,9 +1443,8 @@ bsstest(void)
void void
bigargtest(void) bigargtest(void)
{ {
int pid, ppid; int pid;
ppid = getpid();
pid = fork(0); pid = fork(0);
if(pid == 0){ if(pid == 0){
char *args[32+1]; char *args[32+1];
...@@ -1548,8 +1546,6 @@ main(int argc, char *argv[]) ...@@ -1548,8 +1546,6 @@ main(int argc, char *argv[])
{ {
printf(1, "usertests starting\n"); printf(1, "usertests starting\n");
mtrace_enable_set(1, "xv6-forktest");
if(open("usertests.ran", 0) >= 0){ if(open("usertests.ran", 0) >= 0){
printf(1, "already ran user tests -- rebuild fs.img\n"); printf(1, "already ran user tests -- rebuild fs.img\n");
exit(); exit();
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论