diff options
author | Martin Schwenke <martin@meltin.net> | 2011-12-15 11:21:34 +1100 |
---|---|---|
committer | Martin Schwenke <martin@meltin.net> | 2012-02-06 16:00:23 +1100 |
commit | 7a1ed1957835b69f29254989cf9584d876725508 (patch) | |
tree | fef53bc959e8e0ddbc2a5e2472a83041cba0eaaa | |
parent | 4bf69a0fffc716d650167d28dfb7fbcd96f5ed37 (diff) | |
download | samba-7a1ed1957835b69f29254989cf9584d876725508.tar.gz samba-7a1ed1957835b69f29254989cf9584d876725508.tar.xz samba-7a1ed1957835b69f29254989cf9584d876725508.zip |
Tests - allow tools/ctdb.c:main() to be used
We'll need stubs somewhere else...
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit 6f29c39d666485fddef60e9d87bf94082d179ebb)
-rw-r--r-- | ctdb/tests/src/ctdb_test.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/ctdb/tests/src/ctdb_test.c b/ctdb/tests/src/ctdb_test.c index 533f3f48a1..83322d0ca7 100644 --- a/ctdb/tests/src/ctdb_test.c +++ b/ctdb/tests/src/ctdb_test.c @@ -20,11 +20,41 @@ #ifndef _CTDBD_TEST_C #define _CTDBD_TEST_C +#ifdef CTDB_TEST_USE_MAIN + +/* Use main, stubify some stuff */ +#define _GNU_SOURCE +#include <stdio.h> +#include <sys/socket.h> +#include "lib/tevent/tevent.h" + +#define tevent_context_init(x) tevent_context_init_foobar(x) +struct tevent_context *tevent_context_init_foobar(TALLOC_CTX *mem_ctx); +#define tevent_loop_allow_nesting(x) tevent_loop_allow_nesting_foobar(x) +void tevent_loop_allow_nesting_foobar(struct tevent_context *ev); +#define ctdb_cmdline_client(x, y) ctdb_cmdline_client_foobar(x, y) +#define ctdb_get_socketname(x) ctdb_get_socketname_foobar(x) + +#else + +/* Define our own main() and usage() functions */ #define main(argc, argv) main_foobar(argc, argv) #define usage usage_foobar + +#endif /* CTDB_TEST_USE_MAIN */ + #include "tools/ctdb.c" + +#ifdef CTDB_TEST_USE_MAIN +#undef tevent_context_init +#undef tevent_loop_allow_nesting +#undef ctdb_cmdline_client +#undef ctdb_get_socketname +#else #undef main #undef usage +#endif /* CTDB_TEST_USE_MAIN */ + #undef TIMELIMIT #include "tools/ctdb_vacuum.c" |