tests/tool: Remove references in libctdb in file and function names
authorMartin Schwenke <martin@meltin.net>
Wed, 18 Sep 2013 04:27:03 +0000 (14:27 +1000)
committerAmitay Isaacs <amitay@gmail.com>
Fri, 4 Oct 2013 05:15:35 +0000 (15:15 +1000)
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>

Makefile.in
tests/src/ctdb_functest.c [moved from tests/src/ctdb_tool_libctdb.c with 88% similarity]
tests/src/ctdb_test.c
tests/src/ctdb_test_stubs.c [moved from tests/src/libctdb_test.c with 94% similarity]
tests/src/ctdb_tool_stubby.c [deleted file]
tests/tool/README
tests/tool/scripts/local.sh

index 1310e1693ca046971407bdb908a22743bee7df79..4e03716b761b944f3dc75a7db97a8694c625f9e4 100755 (executable)
@@ -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 $@
similarity index 88%
rename from tests/src/ctdb_tool_libctdb.c
rename to tests/src/ctdb_functest.c
index 81755d4bbb428be9711b7a7c1ed91b5242c6988d..16ca4fddd6471ccfd491bf62d9d89448014ab6bd 100644 (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);
 }
 
index 5b0160a05ccb51da1b9bfcafd97b53670b996ca9..bbb51bd877c8425bf8c348fbabefd6d1763425db 100644 (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 */
similarity index 94%
rename from tests/src/libctdb_test.c
rename to tests/src/ctdb_test_stubs.c
index 31d163583f713e0f2e545f2670b9b85a8dca5dde..456b1fdc0ce8fe66d1724c028687842144ab821e 100644 (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;
 }
diff --git a/tests/src/ctdb_tool_stubby.c b/tests/src/ctdb_tool_stubby.c
deleted file mode 100644 (file)
index 5492c8a..0000000
+++ /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"
index d4a4a347daca7a5699fee8728d11249fcf569d4d..816052862fd3407744fafceec4b26caf9503c990 100644 (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.
index 3b9670c8c19a5c7c3006bf68c6794a2a005b0f5c..385e2ad64b4d997f11e3c5a7eff760593de11f98 100644 (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\""