1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
| | #ifndef _NOTMUCH_TEST_H
#define _NOTMUCH_TEST_H
#include <stdio.h>
#include <stdlib.h>
#include <notmuch.h>
#include <dlfcn.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
inline static void
expect0 (int line, notmuch_status_t ret)
{
if (ret) {
fprintf (stderr, "line %d: %d\n", line, ret);
exit (1);
}
}
#define EXPECT0(v) expect0 (__LINE__, v);
#define TEST_SAVE_ORIG(func) \
if (! orig_##func) { \
void *handle; \
char *error; \
handle = dlopen("libnotmuch.so", RTLD_LAZY); \
if (! handle) { \
fputs(dlerror(), stderr); \
exit(1); \
} \
orig_##func = dlsym(handle, #func); \
if ((error = dlerror()) != NULL) { \
fprintf(stderr, "%s\n", error); \
exit(1); \
} \
}
#endif
|