Get rid of unnecessary barrier. Improve comment.
[pintos-anon] / grading / filesys / syn-write.c
1 #include <random.h>
2 #include <stdio.h>
3 #include <string.h>
4 #include <syscall.h>
5 #include "fslib.h"
6 #include "syn-write.h"
7
8 const char test_name[] = "syn-write";
9
10 char buf1[BUF_SIZE];
11 char buf2[BUF_SIZE];
12
13 void
14 test_main (void) 
15 {
16   pid_t children[CHILD_CNT];
17   int fd;
18
19   CHECK (create (filename, sizeof buf1), "create \"%s\"", filename);
20
21   exec_children ("child-syn-wrt", children, CHILD_CNT);
22   wait_children (children, CHILD_CNT);
23
24   CHECK ((fd = open (filename)) > 1, "open \"%s\"", filename);
25   CHECK (read (fd, buf1, sizeof buf1) > 0, "read \"%s\"", filename);
26   random_bytes (buf2, sizeof buf2);
27   compare_bytes (buf1, buf2, sizeof buf1, 0, filename);
28 }