1 /* Spawns several child processes to write out different parts of
2 the contents of a file and waits for them to finish. Then
3 reads back the file and verifies its contents. */
9 #include "tests/filesys/base/syn-write.h"
10 #include "tests/lib.h"
11 #include "tests/main.h"
19 pid_t children[CHILD_CNT];
22 CHECK (create (file_name, sizeof buf1), "create \"%s\"", file_name);
24 exec_children ("child-syn-wrt", children, CHILD_CNT);
25 wait_children (children, CHILD_CNT);
27 CHECK ((fd = open (file_name)) > 1, "open \"%s\"", file_name);
28 CHECK (read (fd, buf1, sizeof buf1) > 0, "read \"%s\"", file_name);
29 random_bytes (buf2, sizeof buf2);
30 compare_bytes (buf1, buf2, sizeof buf1, 0, file_name);