Not much: factor sbrksimple from big sbrktest

This commit is contained in:
Frans Kaashoek 2019-09-20 17:07:41 -04:00
parent 7c7ed20822
commit ee67dbd211

View file

@ -1558,16 +1558,11 @@ forktest(char *s)
} }
void void
sbrktest(char *s) sbrkbasic(char *s)
{ {
enum { BIG=100*1024*1024, TOOMUCH=1024*1024*1024}; enum { TOOMUCH=1024*1024*1024};
int i, fds[2], pids[10], pid, ppid; int i, pid, xstatus;
char *c, *oldbrk, scratch, *a, *b, *lastaddr, *p; char *c, *a, *b;
uint64 amt;
int fd;
int n;
oldbrk = sbrk(0);
// does sbrk() return the expected failure value? // does sbrk() return the expected failure value?
a = sbrk(TOOMUCH); a = sbrk(TOOMUCH);
@ -1600,7 +1595,21 @@ sbrktest(char *s)
} }
if(pid == 0) if(pid == 0)
exit(0); exit(0);
wait(0); wait(&xstatus);
exit(xstatus);
}
void
sbrkmuch(char *s)
{
enum { BIG=100*1024*1024, TOOMUCH=1024*1024*1024};
int i, fds[2], pids[10], pid, ppid;
char *c, *oldbrk, scratch, *a, *lastaddr, *p;
uint64 amt;
int fd;
int n;
oldbrk = sbrk(0);
// can one grow address space to something big? // can one grow address space to something big?
a = sbrk(0); a = sbrk(0);
@ -2076,7 +2085,8 @@ main(int argc, char *argv[])
{bigargtest, "bigargtest"}, {bigargtest, "bigargtest"},
{bigwrite, "bigwrite"}, {bigwrite, "bigwrite"},
{bsstest, "bsstest"}, {bsstest, "bsstest"},
{sbrktest, "sbrktest"}, {sbrkbasic, "sbrkbasic"},
{sbrkmuch, "sbrkmuch"},
{validatetest, "validatetest"}, {validatetest, "validatetest"},
{stacktest, "stacktest"}, {stacktest, "stacktest"},
{opentest, "opentest"}, {opentest, "opentest"},