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