]> git.ozlabs.org Git - ccan/blob - ccan/io/test/run-13-all-idle.c
ccan/io: test custom io functions.
[ccan] / ccan / io / test / run-13-all-idle.c
1 #include <ccan/io/io.h>
2 /* Include the C files directly. */
3 #include <ccan/io/poll.c>
4 #include <ccan/io/io.c>
5 #include <ccan/tap/tap.h>
6 #include <sys/wait.h>
7 #include <stdio.h>
8 #include <signal.h>
9
10 int main(void)
11 {
12         int status;
13
14         plan_tests(3);
15
16         if (fork() == 0) {
17                 int fds[2];
18
19                 ok1(pipe(fds) == 0);
20                 io_new_conn(fds[0], io_idle(), NULL, NULL);
21                 io_loop();
22                 exit(1);
23         }
24
25         ok1(wait(&status) != -1);
26         ok1(WIFSIGNALED(status));
27         ok1(WTERMSIG(status) == SIGABRT);
28
29         /* This exits depending on whether all tests passed */
30         return exit_status();
31 }