unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
blob ed713099b1d3b435024abae6d100d6c1ddf75a4d 1156 bytes (raw)
name: test/notmuch-test.h 	 # note: path name is non-authoritative(*)

 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
41
42
43
44
45
46
47
48
49
50
 
#ifndef _NOTMUCH_TEST_H
#define _NOTMUCH_TEST_H
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif

#include <assert.h>
#include <dlfcn.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <talloc.h>
#include <unistd.h>

#include <notmuch.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);

inline static void *
dlsym_next (const char *symbol)
{
    void *sym = dlsym (RTLD_NEXT, symbol);
    char *str = dlerror ();

    if (str != NULL) {
	fprintf (stderr, "finding symbol '%s' failed: %s", symbol, str);
	exit (77);
    }
    return sym;
}

#define WRAP_DLFUNC(_rtype, _func, _args)                               \
    _rtype _func _args;                                                 \
    _rtype _func _args {                                                \
	static _rtype (*_func##_orig) _args = NULL;                         \
	if (! _func##_orig ) *(void **) (&_func##_orig) = dlsym_next (#_func);
#endif

debug log:

solving ed713099 ...
found ed713099 in https://yhetil.org/notmuch.git/

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).