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>
11 static void finished_read(struct io_conn *conn, int *expect)
13 ok1(errno == *expect);
16 static struct io_plan *init_conn_read(struct io_conn *conn, int *expect)
18 io_set_finish(conn, finished_read, expect);
19 return io_read(conn, &expect, sizeof(expect), io_never, expect);
22 static struct io_plan *init_conn_read_partial(struct io_conn *conn, int *expect)
24 io_set_finish(conn, finished_read, expect);
25 return io_read_partial(conn, &expect, sizeof(expect), &len,
31 int fd, expect_errno = 0;
33 /* This is how many tests you plan to run */
35 fd = open("/dev/null", O_RDONLY);
36 io_new_conn(NULL, fd, init_conn_read, &expect_errno);
38 fd = open("/dev/null", O_RDONLY);
39 io_new_conn(NULL, fd, init_conn_read_partial, &expect_errno);
43 /* This exits depending on whether all tests passed */