1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-02 09:47:23 +03:00

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)
This commit is contained in:
Martin Schwenke 2013-09-18 14:27:03 +10:00 committed by Amitay Isaacs
parent f3b1790819
commit 24fb430d6e
7 changed files with 40 additions and 62 deletions

View File

@ -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 $@

View File

@ -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);
}

View File

@ -99,6 +99,6 @@
#include "client/ctdb_client.c"
/* TEST STUBS */
#include "libctdb_test.c"
#include "ctdb_test_stubs.c"
#endif /* _CTDBD_TEST_C */

View File

@ -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;
}

View File

@ -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"

View File

@ -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.

View File

@ -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\""