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, ...);
19 #define skip(test, ...) do {if (test) {skippy(__VA_ARGS__, NULL); break;}
20 #define endskip } while (0)
23 # define dies_ok_common(code, for_death, ...) \
\r
24 ok(1, "# SKIP unable to test if code dies on windows");
\r
27 # include <sys/types.h>
28 # include <sys/wait.h>
29 int tap_test_died (int status);
30 # define dies_ok_common(code, for_death, ...) \
\r
33 int cpid = fork(); \
\r
36 perror("fork error"); \
\r
37 exit(EXIT_FAILURE); \
\r
38 case 0: /* child */ \
\r
39 close(1); close(2); \
\r
42 exit(EXIT_SUCCESS); \
\r
44 if (waitpid(cpid, NULL, 0) < 0) { \
\r
45 perror("waitpid error"); \
\r
46 exit(EXIT_FAILURE); \
\r
48 int it_died = tap_test_died(0); \
\r
49 if (!it_died) {code} \
\r
50 ok(for_death ? it_died : !it_died, ## __VA_ARGS__); \
\r
54 #define dies_ok(code, ...) dies_ok_common(code, 1, ## __VA_ARGS__)
\r
55 #define lives_ok(code, ...) dies_ok_common(code, 0, ## __VA_ARGS__)
\r