5 #include <ccan/tap/tap.h>
6 #include <ccan/failtest/failtest.c>
15 failpath = "mceopwrMCEOPWR";
17 ok1((p = failtest_malloc(10, "run-failpath.c", 1)) != NULL);
18 ok1(failtest_calloc(10, 5, "run-failpath.c", 1) != NULL);
19 ok1((p = failtest_realloc(p, 100, "run-failpath.c", 1)) != NULL);
20 ok1((fd = failtest_open("failpath-scratch", "run-failpath.c", 1,
21 O_RDWR|O_CREAT, 0600)) >= 0);
22 ok1(failtest_pipe(fds, "run-failpath.c", 1) == 0);
23 ok1(failtest_write(fd, "xxxx", 4, "run-failpath.c", 1) == 4);
24 lseek(fd, 0, SEEK_SET);
25 ok1(failtest_read(fd, p, 5, "run-failpath.c", 1) == 4);
27 /* Now we're into the failures. */
28 ok1(failtest_malloc(10, "run-failpath.c", 1) == NULL);
29 ok1(failtest_calloc(10, 5, "run-failpath.c", 1) == NULL);
30 ok1(failtest_realloc(p, 100, "run-failpath.c", 1) == NULL);
31 ok1(failtest_open("failpath-scratch", "run-failpath.c", 1,
32 O_RDWR|O_CREAT, 0600) == -1);
33 ok1(failtest_pipe(fds, "run-failpath.c", 1) == -1);
34 ok1(failtest_write(fd, "xxxx", 4, "run-failpath.c", 1) == -1);
35 lseek(fd, 0, SEEK_SET);
36 ok1(failtest_read(fd, p, 5, "run-failpath.c", 1) == -1);