summaryrefslogtreecommitdiff
path: root/user
diff options
context:
space:
mode:
authorRobert Morris <[email protected]>2022-10-04 11:52:57 -0400
committerRobert Morris <[email protected]>2022-10-04 11:52:57 -0400
commitd2b2dff7490f2c4b8e91f79940fc46f0361c216c (patch)
tree2db70a0e68469411a5b2cb007e8ec65f67790439 /user
parent989e8f2f1f5bd68731472874bed19fab48a202af (diff)
downloadxv6-labs-d2b2dff7490f2c4b8e91f79940fc46f0361c216c.tar.gz
xv6-labs-d2b2dff7490f2c4b8e91f79940fc46f0361c216c.tar.bz2
xv6-labs-d2b2dff7490f2c4b8e91f79940fc46f0361c216c.zip
fix copyout() to refuse to write a read-only page
Diffstat (limited to 'user')
-rw-r--r--user/usertests.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/user/usertests.c b/user/usertests.c
index 7d3e9bc..7f35c38 100644
--- a/user/usertests.c
+++ b/user/usertests.c
@@ -76,7 +76,7 @@ copyin(char *s)
void
copyout(char *s)
{
- uint64 addrs[] = { 0x80000000LL, 0xffffffffffffffff };
+ uint64 addrs[] = { 0LL, 0x80000000LL, 0xffffffffffffffff };
for(int ai = 0; ai < 2; ai++){
uint64 addr = addrs[ai];
@@ -2821,7 +2821,7 @@ diskfull(char *s)
unlink("diskfulldir");
- for(fi = 0; done == 0; fi++){
+ for(fi = 0; done == 0 && '0' + fi < 0177; fi++){
char name[32];
name[0] = 'b';
name[1] = 'i';
@@ -2882,7 +2882,7 @@ diskfull(char *s)
unlink(name);
}
- for(int i = 0; i < fi; i++){
+ for(int i = 0; '0' + i < 0177; i++){
char name[32];
name[0] = 'b';
name[1] = 'i';
@@ -2965,12 +2965,14 @@ run(void f(char *), char *s) {
}
int
-runtests(struct test *tests, char *justone) {
+runtests(struct test *tests, char *justone, int continuous) {
for (struct test *t = tests; t->s != 0; t++) {
if((justone == 0) || strcmp(t->s, justone) == 0) {
if(!run(t->f, t->s)){
- printf("SOME TESTS FAILED\n");
- return 1;
+ if(continuous != 2){
+ printf("SOME TESTS FAILED\n");
+ return 1;
+ }
}
}
}
@@ -3050,7 +3052,7 @@ drivetests(int quick, int continuous, char *justone) {
printf("usertests starting\n");
int free0 = countfree();
int free1 = 0;
- if (runtests(quicktests, justone)) {
+ if (runtests(quicktests, justone, continuous)) {
if(continuous != 2) {
return 1;
}
@@ -3058,7 +3060,7 @@ drivetests(int quick, int continuous, char *justone) {
if(!quick) {
if (justone == 0)
printf("usertests slow tests starting\n");
- if (runtests(slowtests, justone)) {
+ if (runtests(slowtests, justone, continuous)) {
if(continuous != 2) {
return 1;
}