8 const char test_name[] = "syn-write";
16 pid_t children[CHILD_CNT];
20 check (create (filename, sizeof buf1), "create \"%s\"", filename);
22 for (i = 0; i < CHILD_CNT; i++)
25 snprintf (cmd_line, sizeof cmd_line, "child-syn-wrt %d", i);
26 check ((children[i] = exec (cmd_line)) != PID_ERROR,
27 "exec child %d of %d: \"%s\"", i + 1, (int) CHILD_CNT, cmd_line);
30 for (i = 0; i < CHILD_CNT; i++)
32 int status = join (children[i]);
33 check (status == i, "join child %d of %d", i + 1, (int) CHILD_CNT);
36 check ((fd = open (filename)) > 1, "open \"%s\"", filename);
37 check (read (fd, buf1, sizeof buf1) > 0, "read \"%s\"", filename);
38 random_bytes (buf2, sizeof buf2);
39 compare_bytes (buf1, buf2, sizeof buf1, 0, filename);