X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Fio%2Ftest%2Frun-13-all-idle.c;fp=ccan%2Fio%2Ftest%2Frun-13-all-idle.c;h=b6a52a55790da4aec03d35e53eede81b6990e2cf;hb=02388bfc242abbd33c7ba64b2c32d425f5359b67;hp=0000000000000000000000000000000000000000;hpb=a2dffefa5ef8d0cf71d99755c4640a8004679b1d;p=ccan diff --git a/ccan/io/test/run-13-all-idle.c b/ccan/io/test/run-13-all-idle.c new file mode 100644 index 00000000..b6a52a55 --- /dev/null +++ b/ccan/io/test/run-13-all-idle.c @@ -0,0 +1,36 @@ +#include +/* Include the C files directly. */ +#include +#include +#include +#include +#include +#include + +static struct io_op *start(struct io_conn *conn, void *unused) +{ + return io_idle(conn); +} + +int main(void) +{ + int status; + + plan_tests(3); + + if (fork() == 0) { + int fds[2]; + + ok1(pipe(fds) == 0); + io_new_conn(fds[0], start, NULL, NULL); + io_loop(); + exit(1); + } + + ok1(wait(&status) != -1); + ok1(WIFSIGNALED(status)); + ok1(WTERMSIG(status) == SIGABRT); + + /* This exits depending on whether all tests passed */ + return exit_status(); +}