summaryrefslogtreecommitdiffstats
path: root/ctdb/tests/src
diff options
context:
space:
mode:
Diffstat (limited to 'ctdb/tests/src')
-rw-r--r--ctdb/tests/src/ctdb_lock_tdb.c2
-rw-r--r--ctdb/tests/src/ctdb_porting_tests.c6
-rw-r--r--ctdb/tests/src/ctdb_takeover_tests.c37
-rw-r--r--ctdb/tests/src/ctdb_test_stubs.c20
-rw-r--r--ctdb/tests/src/ctdb_trackingdb_test.c6
-rw-r--r--ctdb/tests/src/rb_test.c14
6 files changed, 46 insertions, 39 deletions
diff --git a/ctdb/tests/src/ctdb_lock_tdb.c b/ctdb/tests/src/ctdb_lock_tdb.c
index ad2a3297d3..a53ffa13f9 100644
--- a/ctdb/tests/src/ctdb_lock_tdb.c
+++ b/ctdb/tests/src/ctdb_lock_tdb.c
@@ -6,7 +6,7 @@
const char *tdb_file;
TDB_CONTEXT *tdb;
-void signal_handler(int signum)
+static void signal_handler(int signum)
{
tdb_close(tdb);
}
diff --git a/ctdb/tests/src/ctdb_porting_tests.c b/ctdb/tests/src/ctdb_porting_tests.c
index 6752f84cbe..bd78361086 100644
--- a/ctdb/tests/src/ctdb_porting_tests.c
+++ b/ctdb/tests/src/ctdb_porting_tests.c
@@ -191,7 +191,7 @@ static int fork_helper(void)
/*
tests
*/
-int test_ctdb_sys_check_iface_exists(void)
+static int test_ctdb_sys_check_iface_exists(void)
{
const char *fakename = "fake";
bool test;
@@ -206,7 +206,7 @@ int test_ctdb_sys_check_iface_exists(void)
return 0;
}
-int test_ctdb_get_peer_pid(void)
+static int test_ctdb_get_peer_pid(void)
{
int ret;
int fd;
@@ -233,7 +233,7 @@ int test_ctdb_get_peer_pid(void)
return 0;
}
-int test_ctdb_get_process_name(void)
+static int test_ctdb_get_process_name(void)
{
char *process_name = NULL;
globals.testcount++;
diff --git a/ctdb/tests/src/ctdb_takeover_tests.c b/ctdb/tests/src/ctdb_takeover_tests.c
index 7fd989eaf6..04b49e879b 100644
--- a/ctdb/tests/src/ctdb_takeover_tests.c
+++ b/ctdb/tests/src/ctdb_takeover_tests.c
@@ -74,7 +74,7 @@ read_ctdb_public_ip_list(TALLOC_CTX *ctx)
return ret;
}
-void print_ctdb_public_ip_list(struct ctdb_public_ip_list * ips)
+static void print_ctdb_public_ip_list(struct ctdb_public_ip_list * ips)
{
while (ips) {
printf("%s %d\n", ctdb_addr_to_str(&(ips->addr)), ips->pnn);
@@ -84,7 +84,7 @@ void print_ctdb_public_ip_list(struct ctdb_public_ip_list * ips)
/* Read some IPs from stdin, 1 per line, parse them and then print
* them back out. */
-void ctdb_test_read_ctdb_public_ip_list(void)
+static void ctdb_test_read_ctdb_public_ip_list(void)
{
struct ctdb_public_ip_list *l;
@@ -212,7 +212,8 @@ read_ctdb_public_ip_info(TALLOC_CTX *ctx,
return true;
}
-void print_ctdb_available_ips(int numnodes, struct ctdb_all_public_ips **avail)
+static void print_ctdb_available_ips(int numnodes,
+ struct ctdb_all_public_ips **avail)
{
int n, i;
@@ -229,7 +230,7 @@ void print_ctdb_available_ips(int numnodes, struct ctdb_all_public_ips **avail)
}
}
-void ctdb_test_read_ctdb_public_ip_info(const char nodestates[])
+static void ctdb_test_read_ctdb_public_ip_info(const char nodestates[])
{
int numnodes;
struct ctdb_public_ip_list *l;
@@ -261,7 +262,7 @@ void ctdb_test_read_ctdb_public_ip_info(const char nodestates[])
}
/* Read 2 IPs from stdin, calculate the IP distance and print it. */
-void ctdb_test_ip_distance(void)
+static void ctdb_test_ip_distance(void)
{
struct ctdb_public_ip_list *l;
uint32_t distance;
@@ -281,7 +282,7 @@ void ctdb_test_ip_distance(void)
/* Read some IPs from stdin, calculate the sum of the squares of the
* IP distances between the 1st argument and those read that are on
* the given node. The given IP must one of the ones in the list. */
-void ctdb_test_ip_distance_2_sum(const char ip[], int pnn)
+static void ctdb_test_ip_distance_2_sum(const char ip[], int pnn)
{
struct ctdb_public_ip_list *l;
struct ctdb_public_ip_list *t;
@@ -318,7 +319,7 @@ void ctdb_test_ip_distance_2_sum(const char ip[], int pnn)
/* Read some IPs from stdin, calculate the sume of the squares of the
* IP distances between the first and the rest, and print it. */
-void ctdb_test_lcp2_imbalance(int pnn)
+static void ctdb_test_lcp2_imbalance(int pnn)
{
struct ctdb_public_ip_list *l;
uint32_t imbalance;
@@ -405,11 +406,11 @@ static enum ctdb_runstate *get_runstate(TALLOC_CTX *tmp_ctx,
* create_merged_ip_list(), so should only be used in tests of
* ctdb_takeover_run_core(). Yes, it is a hack... :-)
*/
-void ctdb_test_init(const char nodestates[],
- struct ctdb_context **ctdb,
- struct ctdb_public_ip_list **all_ips,
- struct ctdb_ipflags **ipflags,
- bool read_ips_for_multiple_nodes)
+static void ctdb_test_init(const char nodestates[],
+ struct ctdb_context **ctdb,
+ struct ctdb_public_ip_list **all_ips,
+ struct ctdb_ipflags **ipflags,
+ bool read_ips_for_multiple_nodes)
{
struct ctdb_all_public_ips **avail;
int i, numnodes;
@@ -501,7 +502,7 @@ void ctdb_test_init(const char nodestates[],
}
/* IP layout is read from stdin. */
-void ctdb_test_lcp2_allocate_unassigned(const char nodestates[])
+static void ctdb_test_lcp2_allocate_unassigned(const char nodestates[])
{
struct ctdb_context *ctdb;
struct ctdb_public_ip_list *all_ips;
@@ -524,7 +525,7 @@ void ctdb_test_lcp2_allocate_unassigned(const char nodestates[])
}
/* IP layout is read from stdin. */
-void ctdb_test_lcp2_failback(const char nodestates[])
+static void ctdb_test_lcp2_failback(const char nodestates[])
{
struct ctdb_context *ctdb;
struct ctdb_public_ip_list *all_ips;
@@ -547,7 +548,7 @@ void ctdb_test_lcp2_failback(const char nodestates[])
}
/* IP layout is read from stdin. */
-void ctdb_test_lcp2_failback_loop(const char nodestates[])
+static void ctdb_test_lcp2_failback_loop(const char nodestates[])
{
struct ctdb_context *ctdb;
struct ctdb_public_ip_list *all_ips;
@@ -572,8 +573,8 @@ void ctdb_test_lcp2_failback_loop(const char nodestates[])
/* IP layout is read from stdin. See comment for ctdb_test_init() for
* explanation of read_ips_for_multiple_nodes.
*/
-void ctdb_test_ctdb_takeover_run_core(const char nodestates[],
- bool read_ips_for_multiple_nodes)
+static void ctdb_test_ctdb_takeover_run_core(const char nodestates[],
+ bool read_ips_for_multiple_nodes)
{
struct ctdb_context *ctdb;
struct ctdb_public_ip_list *all_ips;
@@ -589,7 +590,7 @@ void ctdb_test_ctdb_takeover_run_core(const char nodestates[],
talloc_free(ctdb);
}
-void usage(void)
+static void usage(void)
{
fprintf(stderr, "usage: ctdb_takeover_tests <op>\n");
exit(1);
diff --git a/ctdb/tests/src/ctdb_test_stubs.c b/ctdb/tests/src/ctdb_test_stubs.c
index d36fe81567..82e82f3a4c 100644
--- a/ctdb/tests/src/ctdb_test_stubs.c
+++ b/ctdb/tests/src/ctdb_test_stubs.c
@@ -34,7 +34,7 @@ static struct ctdb_context *ctdb_global;
/* A fake flag that is only supported by some functions */
#define NODE_FLAGS_FAKE_TIMEOUT 0x80000000
-void ctdb_test_stubs_read_nodemap(struct ctdb_context *ctdb)
+static void ctdb_test_stubs_read_nodemap(struct ctdb_context *ctdb)
{
char line[1024];
@@ -131,7 +131,8 @@ void ctdb_test_stubs_read_nodemap(struct ctdb_context *ctdb)
}
}
-void ctdb_test_stubs_print_nodemap(struct ctdb_context *ctdb)
+#ifdef CTDB_TEST_OVERRIDE_MAIN
+static void ctdb_test_stubs_print_nodemap(struct ctdb_context *ctdb)
{
int i;
@@ -143,6 +144,7 @@ void ctdb_test_stubs_print_nodemap(struct ctdb_context *ctdb)
ctdb->nodes[i]->pnn == ctdb->recovery_master ? "\tRECMASTER" : "");
}
}
+#endif
/* Read interfaces information. Same format as "ctdb ifaces -Y"
* output:
@@ -158,7 +160,7 @@ struct ctdb_iface {
uint32_t references;
};
-void ctdb_test_stubs_read_ifaces(struct ctdb_context *ctdb)
+static void ctdb_test_stubs_read_ifaces(struct ctdb_context *ctdb)
{
char line[1024];
struct ctdb_iface *iface;
@@ -218,7 +220,8 @@ void ctdb_test_stubs_read_ifaces(struct ctdb_context *ctdb)
}
}
-void ctdb_test_stubs_print_ifaces(struct ctdb_context *ctdb)
+#ifdef CTDB_TEST_OVERRIDE_MAIN
+static void ctdb_test_stubs_print_ifaces(struct ctdb_context *ctdb)
{
struct ctdb_iface *iface;
@@ -230,6 +233,7 @@ void ctdb_test_stubs_print_ifaces(struct ctdb_context *ctdb)
iface->references);
}
}
+#endif
/* Read vnn map.
* output:
@@ -246,7 +250,7 @@ struct ctdb_vnn_map {
uint32_t *map;
};
*/
-void ctdb_test_stubs_read_vnnmap(struct ctdb_context *ctdb)
+static void ctdb_test_stubs_read_vnnmap(struct ctdb_context *ctdb)
{
char line[1024];
@@ -290,7 +294,8 @@ void ctdb_test_stubs_read_vnnmap(struct ctdb_context *ctdb)
}
}
-void ctdb_test_stubs_print_vnnmap(struct ctdb_context *ctdb)
+#ifdef CTDB_TEST_OVERRIDE_MAIN
+static void ctdb_test_stubs_print_vnnmap(struct ctdb_context *ctdb)
{
int i;
@@ -299,8 +304,9 @@ void ctdb_test_stubs_print_vnnmap(struct ctdb_context *ctdb)
printf("%d\n", ctdb->vnn_map->map[i]);
}
}
+#endif
-void ctdb_test_stubs_fake_setup(struct ctdb_context *ctdb)
+static void ctdb_test_stubs_fake_setup(struct ctdb_context *ctdb)
{
char line[1024];
diff --git a/ctdb/tests/src/ctdb_trackingdb_test.c b/ctdb/tests/src/ctdb_trackingdb_test.c
index ee473c0124..760d314079 100644
--- a/ctdb/tests/src/ctdb_trackingdb_test.c
+++ b/ctdb/tests/src/ctdb_trackingdb_test.c
@@ -33,7 +33,7 @@
#define MAXINDEX 64
char indices[MAXINDEX];
-void vn_cb(struct ctdb_context *ctdb, uint32_t pnn, void *private_data)
+static void vn_cb(struct ctdb_context *ctdb, uint32_t pnn, void *private_data)
{
char *ind = private_data;
@@ -45,7 +45,7 @@ void vn_cb(struct ctdb_context *ctdb, uint32_t pnn, void *private_data)
ind[pnn] = 0;
}
-void verify_nodes(struct ctdb_context *ctdb, TDB_DATA data)
+static void verify_nodes(struct ctdb_context *ctdb, TDB_DATA data)
{
int i;
@@ -61,7 +61,7 @@ void verify_nodes(struct ctdb_context *ctdb, TDB_DATA data)
-void add_node(struct ctdb_context *ctdb, TDB_DATA *data, int pnn)
+static void add_node(struct ctdb_context *ctdb, TDB_DATA *data, int pnn)
{
printf("Add node %d\n", pnn);
if (ctdb_trackingdb_add_pnn(ctdb, data, pnn)) {
diff --git a/ctdb/tests/src/rb_test.c b/ctdb/tests/src/rb_test.c
index 092732bcf9..44842e68a2 100644
--- a/ctdb/tests/src/rb_test.c
+++ b/ctdb/tests/src/rb_test.c
@@ -43,7 +43,7 @@ static double end_timer(void)
int num_records=5;
-void *callback(void *p, void *d)
+static void *callback(void *p, void *d)
{
uint32_t *data = (uint32_t *)d;
@@ -56,12 +56,12 @@ void *callback(void *p, void *d)
return data;
}
-void *random_add(void *p, void *d)
+static void *random_add(void *p, void *d)
{
return p;
}
-int traverse(void *p, void *d)
+static int traverse(void *p, void *d)
{
uint32_t *data = (uint32_t *)d;
@@ -69,14 +69,14 @@ int traverse(void *p, void *d)
return 0;
}
-int random_traverse(void *p, void *d)
+static int random_traverse(void *p, void *d)
{
printf("%s ",(char *)d);
return 0;
}
static uint32_t calc_checksum = 0;
-int traverse_checksum(void *p, void *d)
+static int traverse_checksum(void *p, void *d)
{
int i,j,k;
@@ -85,14 +85,14 @@ int traverse_checksum(void *p, void *d)
return 0;
}
-int count_traverse(void *p, void *d)
+static int count_traverse(void *p, void *d)
{
int *count = p;
(*count)++;
return 0;
}
-int count_traverse_abort(void *p, void *d)
+static int count_traverse_abort(void *p, void *d)
{
int *count = p;
(*count)++;