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