int main(int ac, char **av) { int lc; int pid; tst_parse_opts(ac, av, NULL, NULL); setup(); for (lc = 0; TEST_LOOPING(lc); ++lc) { pid = tst_fork(); fd2 = open_device(); switch (pid) { case 0: send_information(); exit(0); case -1: tst_brkm(TBROK | TERRNO, cleanup, "fork() failed"); default: if (no_events_queued(fd2, 0)) tst_resm(TPASS, "No data received in eventX"); else tst_resm(TFAIL, "Data received in eventX"); SAFE_CLOSE(NULL, fd2); break; } SAFE_WAITPID(NULL, pid, NULL, 0); } cleanup(); tst_exit(); }
int main(int ac, char **av) { int lc; int pid; tst_parse_opts(ac, av, NULL, NULL); for (lc = 0; lc < TEST_LOOPING(lc); ++lc) { setup(); pid = tst_fork(); fd2 = setup_read(); if (!pid) { send_information(); } else { if (check_information()) tst_resm(TFAIL, "Data received in eventX"); else tst_resm(TPASS, "No data received in eventX"); } } tst_exit(); }