summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2013-09-18 14:27:03 +1000
committerAmitay Isaacs <amitay@gmail.com>2013-10-04 15:15:35 +1000
commit24fb430d6e99e60af9b1f9e2e358ec707937e7a8 (patch)
treec51dd93c841f3a33b36641b2b731a99ae389b75c
parentf3b179081933fc942c6fbcac3630203bbb24f0ed (diff)
downloadsamba-24fb430d6e99e60af9b1f9e2e358ec707937e7a8.tar.gz
samba-24fb430d6e99e60af9b1f9e2e358ec707937e7a8.tar.xz
samba-24fb430d6e99e60af9b1f9e2e358ec707937e7a8.zip
tests/tool: Remove references in libctdb in file and function names
Main changes are: libctdb_test.c -> ctdb_test_stubs.c ctdb_tool_libctdb.c -> ctdb_functest.c ctdb_tool_stubby.c is gone, replaced with existing ctdb_test.c. Functions starting with "libctdb_test_" now start with "ctdb_test_stubs_". Signed-off-by: Martin Schwenke <martin@meltin.net> Pair-programmed-with: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 6182bd0c19f215a997efe5272e633b1b1bd0c882)
-rwxr-xr-xctdb/Makefile.in16
-rw-r--r--ctdb/tests/src/ctdb_functest.c (renamed from ctdb/tests/src/ctdb_tool_libctdb.c)26
-rw-r--r--ctdb/tests/src/ctdb_test.c2
-rw-r--r--ctdb/tests/src/ctdb_test_stubs.c (renamed from ctdb/tests/src/libctdb_test.c)24
-rw-r--r--ctdb/tests/src/ctdb_tool_stubby.c20
-rw-r--r--ctdb/tests/tool/README10
-rw-r--r--ctdb/tests/tool/scripts/local.sh4
7 files changed, 40 insertions, 62 deletions
diff --git a/ctdb/Makefile.in b/ctdb/Makefile.in
index 1310e1693ca..4e03716b761 100755
--- a/ctdb/Makefile.in
+++ b/ctdb/Makefile.in
@@ -114,7 +114,7 @@ TEST_BINS=tests/bin/ctdb_bench tests/bin/ctdb_fetch tests/bin/ctdb_fetch_one \
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_update_record_persistent \
- tests/bin/ctdb_tool_libctdb tests/bin/ctdb_tool_stubby \
+ tests/bin/ctdb_functest tests/bin/ctdb_stubtest \
tests/bin/ctdb_porting_tests tests/bin/ctdb_lock_tdb \
@INFINIBAND_BINS@
@@ -266,7 +266,7 @@ tests/bin/ctdb_transaction: $(CTDB_CLIENT_OBJ) tests/src/ctdb_transaction.o
CTDB_SERVER_MOST_OBJ = $(CTDB_SERVER_OBJ:server/ctdbd.o=)
CTDBD_TEST_C = $(CTDB_SERVER_MOST_OBJ:.o=.c) tests/src/ctdbd_test.c
-CTDB_TEST_C = $(CTDB_CLIENT_OBJ:.o=.c) tools/ctdb.c tools/ctdb_vacuum.c tests/src/ctdb_test.c
+CTDB_TEST_C = $(CTDB_CLIENT_OBJ:.o=.c) tools/ctdb.c tools/ctdb_vacuum.c tests/src/ctdb_test_stubs.c
CTDB_TEST_OBJ = $(TALLOC_OBJ) $(TDB_OBJ) \
@CTDB_SYSTEM_OBJ@ $(REPLACE_OBJ) $(EXTRA_OBJ) $(TEVENT_OBJ) $(SOCKET_WRAPPER_OBJ)
@@ -277,17 +277,17 @@ tests/bin/ctdb_takeover_tests: $(CTDB_TEST_OBJ) tests/src/ctdb_takeover_tests.o
@echo Linking $@
$(WRAPPER) $(CC) $(CFLAGS) -o $@ tests/src/ctdb_takeover_tests.o $(CTDB_TEST_OBJ) $(LIB_FLAGS)
-tests/src/ctdb_tool_libctdb.o: tests/src/ctdb_tool_libctdb.c tests/src/libctdb_test.c $(CTDB_TEST_C)
+tests/src/ctdb_functest.o: tests/src/ctdb_functest.c tests/src/ctdb_test.c $(CTDB_TEST_C)
-tests/bin/ctdb_tool_libctdb: $(CTDB_TEST_OBJ) tests/src/ctdb_tool_libctdb.o
+tests/bin/ctdb_functest: tests/src/ctdb_functest.o $(CTDB_TEST_OBJ)
@echo Linking $@
- $(WRAPPER) $(CC) $(CFLAGS) -o $@ tests/src/ctdb_tool_libctdb.o $(CTDB_TEST_OBJ) $(POPT_OBJ) $(LIB_FLAGS)
+ $(WRAPPER) $(CC) $(CFLAGS) -o $@ $^ $(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/src/ctdb_test.o: tests/src/ctdb_test.c $(CTDB_TEST_C)
-tests/bin/ctdb_tool_stubby: $(CTDB_TEST_OBJ) tests/src/ctdb_tool_stubby.o
+tests/bin/ctdb_stubtest: tests/src/ctdb_test.o $(CTDB_TEST_OBJ)
@echo Linking $@
- $(WRAPPER) $(CC) $(CFLAGS) -o $@ tests/src/ctdb_tool_stubby.o $(CTDB_TEST_OBJ) $(POPT_OBJ) $(LIB_FLAGS)
+ $(WRAPPER) $(CC) $(CFLAGS) -o $@ $^ $(POPT_OBJ) $(LIB_FLAGS)
tests/bin/ctdb_lock_tdb: tests/src/ctdb_lock_tdb.o $(CTDB_CLIENT_OBJ)
@echo Linking $@
diff --git a/ctdb/tests/src/ctdb_tool_libctdb.c b/ctdb/tests/src/ctdb_functest.c
index 81755d4bbb4..16ca4fddd64 100644
--- a/ctdb/tests/src/ctdb_tool_libctdb.c
+++ b/ctdb/tests/src/ctdb_functest.c
@@ -1,5 +1,5 @@
/*
- Tests for tools/ctdb.c and libctdb stubs
+ Tests for tools/ctdb.c and CTDB client stubs
Copyright (C) Martin Schwenke 2011
@@ -24,8 +24,8 @@ static void test_read_nodemap(void)
{
struct ctdb_context *ctdb = talloc_zero(NULL, struct ctdb_context);
- libctdb_test_read_nodemap(ctdb);
- libctdb_test_print_nodemap(ctdb);
+ ctdb_test_stubs_read_nodemap(ctdb);
+ ctdb_test_stubs_print_nodemap(ctdb);
talloc_free(ctdb);
}
@@ -34,8 +34,8 @@ static void test_read_ifaces(void)
{
struct ctdb_context *ctdb = talloc_zero(NULL, struct ctdb_context);
- libctdb_test_read_ifaces(ctdb);
- libctdb_test_print_ifaces(ctdb);
+ ctdb_test_stubs_read_ifaces(ctdb);
+ ctdb_test_stubs_print_ifaces(ctdb);
talloc_free(ctdb);
}
@@ -44,8 +44,8 @@ static void test_read_vnnmap(void)
{
struct ctdb_context *ctdb = talloc_zero(NULL, struct ctdb_context);
- libctdb_test_read_vnnmap(ctdb);
- libctdb_test_print_vnnmap(ctdb);
+ ctdb_test_stubs_read_vnnmap(ctdb);
+ ctdb_test_stubs_print_vnnmap(ctdb);
talloc_free(ctdb);
}
@@ -55,14 +55,14 @@ static void test_fake_setup(void)
bool first = true;
struct ctdb_context *ctdb = talloc_zero(NULL, struct ctdb_context);
- libctdb_test_fake_setup(ctdb);
+ ctdb_test_stubs_fake_setup(ctdb);
if (ctdb->nodes != NULL) {
if (!first) {
printf("\n");
}
printf("NODEMAP\n");
- libctdb_test_print_nodemap(ctdb);
+ ctdb_test_stubs_print_nodemap(ctdb);
first = false;
}
@@ -71,7 +71,7 @@ static void test_fake_setup(void)
printf("\n");
}
printf("IFACES\n");
- libctdb_test_print_ifaces(ctdb);
+ ctdb_test_stubs_print_ifaces(ctdb);
first = false;
}
@@ -80,7 +80,7 @@ static void test_fake_setup(void)
printf("\n");
}
printf("VNNMAP\n");
- libctdb_test_print_vnnmap(ctdb);
+ ctdb_test_stubs_print_vnnmap(ctdb);
first = false;
}
@@ -144,7 +144,7 @@ static void test_parse_nodestring(const char *nodestring_s,
ctdb = talloc_zero(NULL, struct ctdb_context);
- libctdb_test_read_nodemap(ctdb);
+ ctdb_test_stubs_read_nodemap(ctdb);
if (parse_nodestring(ctdb, NULL, nodestring, CTDB_CURRENT_NODE, dd_ok,
&nodes, &pnn_mode)) {
@@ -156,7 +156,7 @@ static void test_parse_nodestring(const char *nodestring_s,
static void usage(void)
{
- fprintf(stderr, "usage: ctdb_tool_libctdb <op>\n");
+ fprintf(stderr, "usage: ctdb_tool_functest <op>\n");
exit(1);
}
diff --git a/ctdb/tests/src/ctdb_test.c b/ctdb/tests/src/ctdb_test.c
index 5b0160a05cc..bbb51bd877c 100644
--- a/ctdb/tests/src/ctdb_test.c
+++ b/ctdb/tests/src/ctdb_test.c
@@ -99,6 +99,6 @@
#include "client/ctdb_client.c"
/* TEST STUBS */
-#include "libctdb_test.c"
+#include "ctdb_test_stubs.c"
#endif /* _CTDBD_TEST_C */
diff --git a/ctdb/tests/src/libctdb_test.c b/ctdb/tests/src/ctdb_test_stubs.c
index 31d163583f7..456b1fdc0ce 100644
--- a/ctdb/tests/src/libctdb_test.c
+++ b/ctdb/tests/src/ctdb_test_stubs.c
@@ -1,5 +1,5 @@
/*
- Test stubs and support functions for some libctdb functions
+ Test stubs and support functions for some CTDB client functions
Copyright (C) Martin Schwenke 2011
@@ -21,7 +21,7 @@
* <PNN> <FLAGS> [RECMASTER] [CURRENT]
* EOF or a blank line terminates input.
*/
-void libctdb_test_read_nodemap(struct ctdb_context *ctdb)
+void ctdb_test_stubs_read_nodemap(struct ctdb_context *ctdb)
{
char line[1024];
@@ -102,7 +102,7 @@ void libctdb_test_read_nodemap(struct ctdb_context *ctdb)
}
}
-void libctdb_test_print_nodemap(struct ctdb_context *ctdb)
+void ctdb_test_stubs_print_nodemap(struct ctdb_context *ctdb)
{
int i;
@@ -129,7 +129,7 @@ struct ctdb_iface {
uint32_t references;
};
-void libctdb_test_read_ifaces(struct ctdb_context *ctdb)
+void ctdb_test_stubs_read_ifaces(struct ctdb_context *ctdb)
{
char line[1024];
struct ctdb_iface *iface;
@@ -189,7 +189,7 @@ void libctdb_test_read_ifaces(struct ctdb_context *ctdb)
}
}
-void libctdb_test_print_ifaces(struct ctdb_context *ctdb)
+void ctdb_test_stubs_print_ifaces(struct ctdb_context *ctdb)
{
struct ctdb_iface *iface;
@@ -217,7 +217,7 @@ struct ctdb_vnn_map {
uint32_t *map;
};
*/
-void libctdb_test_read_vnnmap(struct ctdb_context *ctdb)
+void ctdb_test_stubs_read_vnnmap(struct ctdb_context *ctdb)
{
char line[1024];
@@ -261,7 +261,7 @@ void libctdb_test_read_vnnmap(struct ctdb_context *ctdb)
}
}
-void libctdb_test_print_vnnmap(struct ctdb_context *ctdb)
+void ctdb_test_stubs_print_vnnmap(struct ctdb_context *ctdb)
{
int i;
@@ -271,7 +271,7 @@ void libctdb_test_print_vnnmap(struct ctdb_context *ctdb)
}
}
-void libctdb_test_fake_setup(struct ctdb_context *ctdb)
+void ctdb_test_stubs_fake_setup(struct ctdb_context *ctdb)
{
char line[1024];
@@ -284,11 +284,11 @@ void libctdb_test_fake_setup(struct ctdb_context *ctdb)
}
if (strcmp(line, "NODEMAP") == 0) {
- libctdb_test_read_nodemap(ctdb);
+ ctdb_test_stubs_read_nodemap(ctdb);
} else if (strcmp(line, "IFACES") == 0) {
- libctdb_test_read_ifaces(ctdb);
+ ctdb_test_stubs_read_ifaces(ctdb);
} else if (strcmp(line, "VNNMAP") == 0) {
- libctdb_test_read_vnnmap(ctdb);
+ ctdb_test_stubs_read_vnnmap(ctdb);
} else {
printf("Unknown line %s\n", line);
exit(1);
@@ -326,7 +326,7 @@ struct ctdb_context *ctdb_cmdline_client_stub(struct tevent_context *ev,
ctdb_set_socketname(ctdb, "fake");
- libctdb_test_fake_setup(ctdb);
+ ctdb_test_stubs_fake_setup(ctdb);
return ctdb;
}
diff --git a/ctdb/tests/src/ctdb_tool_stubby.c b/ctdb/tests/src/ctdb_tool_stubby.c
deleted file mode 100644
index 5492c8a7188..00000000000
--- a/ctdb/tests/src/ctdb_tool_stubby.c
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- 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/>.
-*/
-
-#include "ctdb_test.c"
diff --git a/ctdb/tests/tool/README b/ctdb/tests/tool/README
index d4a4a347dac..816052862fd 100644
--- a/ctdb/tests/tool/README
+++ b/ctdb/tests/tool/README
@@ -5,15 +5,13 @@ Test case filenames can take 2 forms:
* func.<some_function>.NNN.sh
Run <some_function> in the ctdb tool code using the
- ctdb_tool_libctdb test program. This test program uses test stubs
- for libctdb functions.
+ ctdb_tool_functest test program. This test program uses test stubs
+ for CTDB client functions.
* stubby.<command>.NNN.sh
Run the ctdb_tool_stubby test program with <command> as the 1st
argument - subsequent are passed to simple_test(). ctdb_tool_stubby
- is linked against the test stubs for libctdb functions.
+ is linked against the test stubs for CTDB client functions.
-To add tests here you may need to change commands/functions in the
-ctdb tool so that they use libctdb. You will also need to add the
-appropriate test stubs.
+To add tests here you may need to add appropriate test stubs.
diff --git a/ctdb/tests/tool/scripts/local.sh b/ctdb/tests/tool/scripts/local.sh
index 3b9670c8c19..385e2ad64b4 100644
--- a/ctdb/tests/tool/scripts/local.sh
+++ b/ctdb/tests/tool/scripts/local.sh
@@ -14,12 +14,12 @@ define_test ()
func.*)
_func="${_f#func.}"
_func="${_func%.*}" # Strip test number
- test_prog="ctdb_tool_libctdb ${_func}"
+ test_prog="ctdb_functest ${_func}"
;;
stubby.*)
_cmd="${_f#stubby.}"
_cmd="${_cmd%.*}" # Strip test number
- test_prog="ctdb_tool_stubby ${_cmd}"
+ test_prog="ctdb_stubtest ${_cmd}"
;;
*)
die "Unknown pattern for testcase \"$_f\""