blob: 1c442f52ea2bf215ab4a55a7ae07910eefd53cce (
plain)
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
#ifndef LIBMONGO_CLIENT_TEST_H
#define LIBMONGO_CLIENT_TEST_H 1
#include "tap.h"
#include "bson.h"
#include "mongo-wire.h"
#include "mongo-sync.h"
#include "libmongo-private.h"
#include <dlfcn.h>
typedef struct
{
gchar *primary_host;
gint primary_port;
gchar *secondary_host;
gint secondary_port;
gchar *db;
gchar *coll;
gchar *ns;
gchar *gfs_prefix;
} func_config_t;
extern func_config_t config;
#define begin_network_tests(n) \
do \
{ \
skip(!test_env_setup (), n, "Environment not set up for network tests")
#define end_network_tests() \
endskip; \
test_env_free(); \
} while (0)
#define RUN_TEST(n, t) \
int \
main (void) \
{ \
test_main_setup(); \
plan (n); \
test_##t (); \
return 0; \
}
gboolean test_env_setup (void);
void test_env_free (void);
void test_main_setup (void);
#define RUN_NET_TEST(n, t) \
int \
main (void) \
{ \
test_main_setup(); \
if (!test_env_setup ()) \
printf ("1..0 # skip, Environment not set up for network tests"); \
else \
{ \
plan (n); \
test_##t (); \
} \
test_env_free (); \
return 0; \
}
bson *test_bson_generate_full (void);
mongo_packet *test_mongo_wire_generate_reply (gboolean valid,
gint32 nreturn,
gboolean with_docs);
mongo_sync_connection *test_make_fake_sync_conn (gint fd,
gboolean slaveok);
#define SAVE_OLD_FUNC(n) \
static void *(*func_##n)(); \
if (!func_##n) \
func_##n = (void *(*)())dlsym (RTLD_NEXT, #n);
#define CALL_OLD_FUNC(n, ...) \
func_##n (__VA_ARGS__)
#endif
|