general: simple sysv ipc sem test
[libc-test] / src / general / test.h
1 #include <stdio.h>
2 #include <stdarg.h>
3 #define error(...) test_error(__FILE__, __LINE__, __VA_ARGS__)
4
5 /* TODO: not thread-safe nor fork-safe */
6 static int test_status;
7
8 static int test_error(const char *n, int l, const char *s, ...)
9 {
10         va_list ap;
11
12         if (test_status == 0)
13                 printf("FAIL\n");
14         test_status = 1;
15         printf(" ERROR %s:%d: ", n, l);
16         va_start(ap, s);
17         vprintf(s, ap);
18         va_end(ap);
19         return -1;
20 }
21