X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=inline;f=grading%2Ffilesys%2Fsyn-write.c;h=c7eef3a58f24bebaffb5d96e9ce2189fc6306e20;hb=76b07342aab9c426a0244e0b6b75ba50659a5cc9;hp=ee88c8b5442fce15ea8536cc630f6a80cb32a2f5;hpb=c36e5b768f46fc098377b9a70d2b1c02405ef14a;p=pintos-anon diff --git a/grading/filesys/syn-write.c b/grading/filesys/syn-write.c index ee88c8b..c7eef3a 100644 --- a/grading/filesys/syn-write.c +++ b/grading/filesys/syn-write.c @@ -15,26 +15,14 @@ test_main (void) { pid_t children[CHILD_CNT]; int fd; - int i; - check (create (filename, sizeof buf1), "create \"%s\"", filename); + CHECK (create (filename, sizeof buf1), "create \"%s\"", filename); - for (i = 0; i < CHILD_CNT; i++) - { - char cmd_line[128]; - snprintf (cmd_line, sizeof cmd_line, "child-syn-wrt %d", i); - check ((children[i] = exec (cmd_line)) != PID_ERROR, - "exec child %d of %d: \"%s\"", i + 1, (int) CHILD_CNT, cmd_line); - } + exec_children ("child-syn-wrt", children, CHILD_CNT); + join_children (children, CHILD_CNT); - for (i = 0; i < CHILD_CNT; i++) - { - int status = join (children[i]); - check (status == i, "join child %d of %d", i + 1, (int) CHILD_CNT); - } - - check ((fd = open (filename)) > 1, "open \"%s\"", filename); - check (read (fd, buf1, sizeof buf1) > 0, "read \"%s\"", filename); + CHECK ((fd = open (filename)) > 1, "open \"%s\"", filename); + CHECK (read (fd, buf1, sizeof buf1) > 0, "read \"%s\"", filename); random_bytes (buf2, sizeof buf2); compare_bytes (buf1, buf2, sizeof buf1, 0, filename); }