00001
00002
00003
00004
00005 #include <random.h>
00006 #include <stdio.h>
00007 #include <string.h>
00008 #include <syscall.h>
00009 #include "tests/filesys/base/syn-write.h"
00010 #include "tests/lib.h"
00011 #include "tests/main.h"
00012
00013 char buf1[BUF_SIZE];
00014 char buf2[BUF_SIZE];
00015
00016 void
00017 test_main (void)
00018 {
00019 pid_t children[CHILD_CNT];
00020 int fd;
00021
00022 CHECK (create (file_name, sizeof buf1), "create \"%s\"", file_name);
00023
00024 exec_children ("child-syn-wrt", children, CHILD_CNT);
00025 wait_children (children, CHILD_CNT);
00026
00027 CHECK ((fd = open (file_name)) > 1, "open \"%s\"", file_name);
00028 CHECK (read (fd, buf1, sizeof buf1) > 0, "read \"%s\"", file_name);
00029 random_bytes (buf2, sizeof buf2);
00030 compare_bytes (buf1, buf2, sizeof buf1, 0, file_name);
00031 }