diff options
-rwxr-xr-x | ctdb/Makefile.in | 8 | ||||
-rw-r--r-- | ctdb/tests/src/ctdb_tool_stubby.c | 49 |
2 files changed, 56 insertions, 1 deletions
diff --git a/ctdb/Makefile.in b/ctdb/Makefile.in index 6fdd3f6c3d..15da88398d 100755 --- a/ctdb/Makefile.in +++ b/ctdb/Makefile.in @@ -84,7 +84,7 @@ TEST_BINS=tests/bin/ctdb_bench tests/bin/ctdb_fetch tests/bin/ctdb_fetch_one \ tests/bin/ctdb_randrec tests/bin/ctdb_persistent \ tests/bin/ctdb_traverse tests/bin/rb_test tests/bin/ctdb_transaction \ tests/bin/ctdb_takeover_tests tests/bin/ctdb_update_record \ - tests/bin/ctdb_tool_libctdb \ + tests/bin/ctdb_tool_libctdb tests/bin/ctdb_tool_stubby \ @INFINIBAND_BINS@ BINS = bin/ctdb @CTDB_SCSI_IO@ bin/smnotify bin/ping_pong bin/ltdbtool @CTDB_PMDA@ @@ -254,6 +254,12 @@ tests/bin/ctdb_tool_libctdb: $(CTDB_TEST_OBJ) tests/src/ctdb_tool_libctdb.o @echo Linking $@ @$(CC) $(CFLAGS) -o $@ tests/src/ctdb_tool_libctdb.o $(CTDB_TEST_OBJ) @POPT_OBJ@ $(LIB_FLAGS) +tests/src/ctdb_tool_stubby.o: tests/src/ctdb_tool_stubby.c tests/src/libctdb_test.c $(CTDB_TEST_C) + +tests/bin/ctdb_tool_stubby: $(CTDB_TEST_OBJ) tests/src/ctdb_tool_stubby.o + @echo Linking $@ + @$(CC) $(CFLAGS) -o $@ tests/src/ctdb_tool_stubby.o $(CTDB_TEST_OBJ) @POPT_OBJ@ $(LIB_FLAGS) + tests/bin/ibwrapper_test: $(CTDB_CLIENT_OBJ) ib/ibwrapper_test.o @echo Linking $@ @$(CC) $(CFLAGS) -o $@ ib/ibwrapper_test.o $(CTDB_CLIENT_OBJ) $(LIB_FLAGS) diff --git a/ctdb/tests/src/ctdb_tool_stubby.c b/ctdb/tests/src/ctdb_tool_stubby.c new file mode 100644 index 0000000000..c388c63070 --- /dev/null +++ b/ctdb/tests/src/ctdb_tool_stubby.c @@ -0,0 +1,49 @@ +/* + Tests wrapper for tools/ctdb.c that uses stubs + + Copyright (C) Martin Schwenke 2011 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see <http://www.gnu.org/licenses/>. +*/ + +#define CTDB_TEST_USE_MAIN +#include "ctdb_test.c" + +#include "libctdb_test.c" + +void tevent_loop_allow_nesting_foobar(struct tevent_context *ev) +{ + return; +} + +struct ctdb_context *ctdb_cmdline_client_foobar(struct tevent_context *ev, + struct timeval req_timeout) +{ + struct ctdb_context *ret; + + ret = talloc(NULL, struct ctdb_context); + + return ret; +} + +struct tevent_context *tevent_context_init_foobar(TALLOC_CTX *mem_ctx) +{ + /* This should obviously never be used... */ + return (struct tevent_context *) 1; +} + +const char *ctdb_get_socketname_foobar(struct ctdb_context *ctdb) +{ + return LIBCTDB_TEST_FAKESTATE; +} |