X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=grading%2Ffilesys%2Fchild-syn-read.c;h=f4e49179f1178225285e817a59ad260f8f00681d;hb=a879ea1c5a4b3f7d82b3bcfaf32b0b65cca191a6;hp=90c3ab00b56cf6ba11a5420d3e9ec7f46962e958;hpb=dd2f9330108fbf488d9de8be9b4a7419d0ec97a4;p=pintos-anon diff --git a/grading/filesys/child-syn-read.c b/grading/filesys/child-syn-read.c index 90c3ab0..f4e4917 100644 --- a/grading/filesys/child-syn-read.c +++ b/grading/filesys/child-syn-read.c @@ -3,25 +3,23 @@ #include #include #include "fslib.h" +#include "syn-read.h" const char test_name[128] = "child-syn-read"; -static char buf[1024]; +static char buf[BUF_SIZE]; int main (int argc, const char *argv[]) { - const char *filename = "data"; int child_idx; int fd; size_t i; quiet = true; - check (argc == 3, "argc must be 3, actually %d", argc); + check (argc == 2, "argc must be 2, actually %d", argc); child_idx = atoi (argv[1]); - check (atoi (argv[2]) == (int) sizeof buf, - "argv[2] must be %zu, actually %s", sizeof buf, argv[2]); random_init (0); random_bytes (buf, sizeof buf); @@ -31,7 +29,7 @@ main (int argc, const char *argv[]) { char c; check (read (fd, &c, 1) > 0, "read \"%s\"", filename); - check (c != buf[i], "byte %zu differs from expected", i); + compare_bytes (&c, buf + i, 1, i, filename); } close (fd);