8 #define ok(...) ok_at_loc(__FILE__, __LINE__, __VA_ARGS__, NULL)
9 #define pass(...) ok(1, ## __VA_ARGS__)
10 #define fail(...) ok(0, ## __VA_ARGS__)
12 void plan (int tests);
\r
13 int ok_at_loc (const char *file, int line, int test, const char *fmt, ...);
\r
14 int diag (const char *fmt, ...);
\r
15 int note (const char *fmt, ...);
\r
16 int exit_status (void);
\r
17 void skippy (int test, const char *fmt, ...);
18 void ctodo (int ignore, const char *fmt, ...);
21 #define skip(test, ...) do {if (test) {skippy(__VA_ARGS__, NULL); break;}
22 #define endskip } while (0)
24 #define todo(...) ctodo(0, ## __VA_ARGS__, NULL)
25 #define endtodo cendtodo()
28 # define dies_ok_common(code, for_death, ...) \
\r
29 ok(1, "# SKIP unable to test if code dies on windows");
\r
32 # include <sys/types.h>
33 # include <sys/wait.h>
34 int tap_test_died (int status);
35 # define dies_ok_common(code, for_death, ...) \
\r
38 int cpid = fork(); \
\r
41 perror("fork error"); \
\r
42 exit(EXIT_FAILURE); \
\r
43 case 0: /* child */ \
\r
44 close(1); close(2); \
\r
47 exit(EXIT_SUCCESS); \
\r
49 if (waitpid(cpid, NULL, 0) < 0) { \
\r
50 perror("waitpid error"); \
\r
51 exit(EXIT_FAILURE); \
\r
53 int it_died = tap_test_died(0); \
\r
54 if (!it_died) {code} \
\r
55 ok(for_death ? it_died : !it_died, ## __VA_ARGS__); \
\r
59 #define dies_ok(code, ...) dies_ok_common(code, 1, ## __VA_ARGS__)
\r
60 #define lives_ok(code, ...) dies_ok_common(code, 0, ## __VA_ARGS__)
\r