diff options
| author | Andrew Tridgell <tridge@samba.org> | 2007-06-02 13:31:36 +1000 |
|---|---|---|
| committer | Andrew Tridgell <tridge@samba.org> | 2007-06-02 13:31:36 +1000 |
| commit | c5e4ce360aaa2dc5d3b0f39380dcd9bf28fc3815 (patch) | |
| tree | 253d347621e99648869612c0ddd8703a698716f6 | |
| parent | 68963d865a36ea6c717c6dfb729a932f3dcefa7c (diff) | |
make test now works again
(This used to be ctdb commit 439d87bbb9840f82937e51aff4fe2b80160878c6)
| -rw-r--r-- | ctdb/include/ctdb.h | 8 | ||||
| -rw-r--r-- | ctdb/include/ctdb_private.h | 7 | ||||
| -rwxr-xr-x | ctdb/tests/bench.sh | 4 | ||||
| -rw-r--r-- | ctdb/tests/ctdb_bench.c | 29 | ||||
| -rw-r--r-- | ctdb/tests/ctdb_fetch.c | 12 | ||||
| -rwxr-xr-x | ctdb/tests/ctdbd.sh | 1 | ||||
| -rwxr-xr-x | ctdb/tests/fetch.sh | 3 |
7 files changed, 32 insertions, 32 deletions
diff --git a/ctdb/include/ctdb.h b/ctdb/include/ctdb.h index 502dad8c2a..6dc5ffac54 100644 --- a/ctdb/include/ctdb.h +++ b/ctdb/include/ctdb.h @@ -72,6 +72,14 @@ struct ctdb_call_info { */ #define CTDB_SRVID_RELEASE_IP 0xF300000000000000LL +/* used on the domain socket, send a pdu to the local daemon */ +#define CTDB_CURRENT_NODE 0xF0000001 +/* send a broadcast to all nodes in the cluster, active or not */ +#define CTDB_BROADCAST_ALL 0xF0000002 +/* send a broadcast to all nodes in the current vnn map */ +#define CTDB_BROADCAST_VNNMAP 0xF0000003 + + struct event_context; /* diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h index a035af59ab..c58441c9f3 100644 --- a/ctdb/include/ctdb_private.h +++ b/ctdb/include/ctdb_private.h @@ -38,13 +38,6 @@ #define CTDB_NULL_FUNC 0xFF000001 #define CTDB_FETCH_FUNC 0xFF000002 -/* used on the domain socket, send a pdu to the local daemon */ -#define CTDB_CURRENT_NODE 0xF0000001 -/* send a broadcast to all nodes in the cluster, active or not */ -#define CTDB_BROADCAST_ALL 0xF0000002 -/* send a broadcast to all nodes in the current vnn map */ -#define CTDB_BROADCAST_VNNMAP 0xF0000003 - #define CTDB_MAX_REDIRECT_COUNT 3 #define CTDB_DEFAULT_SEQNUM_FREQUENCY 1 diff --git a/ctdb/tests/bench.sh b/ctdb/tests/bench.sh index 778619488d..495abbffe8 100755 --- a/ctdb/tests/bench.sh +++ b/ctdb/tests/bench.sh @@ -20,8 +20,8 @@ done killall -9 ctdb_bench echo "Trying $NUMNODES nodes" for i in `seq 1 $NUMNODES`; do - $VALGRIND bin/ctdb_bench --nlist nodes.txt --socket sock.$i $* & + valgrind -q $VALGRIND bin/ctdb_bench --socket sock.$i -n $NUMNODES $* & done wait -ctdb shutdown --socket sock.1 -n all +bin/ctdb shutdown --socket sock.1 -n all diff --git a/ctdb/tests/ctdb_bench.c b/ctdb/tests/ctdb_bench.c index 4ea206f732..2b4dba6e8f 100644 --- a/ctdb/tests/ctdb_bench.c +++ b/ctdb/tests/ctdb_bench.c @@ -44,8 +44,7 @@ static double end_timer(void) static int timelimit = 10; static int num_records = 10; -static int num_msgs = 1; -static uint32_t num_nodes; +static int num_nodes; enum my_functions {FUNC_INCR=1, FUNC_FETCH=2}; @@ -109,7 +108,6 @@ static void bench_ring(struct ctdb_context *ctdb, struct event_context *ev) int vnn=ctdb_get_vnn(ctdb); if (vnn == 0) { - int i; /* two messages are injected into the ring, moving in opposite directions */ int dest, incr; @@ -118,15 +116,13 @@ static void bench_ring(struct ctdb_context *ctdb, struct event_context *ev) data.dptr = (uint8_t *)&incr; data.dsize = sizeof(incr); - for (i=0;i<num_msgs;i++) { - incr = 1; - dest = (ctdb_get_vnn(ctdb) + incr) % num_nodes; - ctdb_send_message(ctdb, dest, 0, data); - - incr = -1; - dest = (ctdb_get_vnn(ctdb) + incr) % num_nodes; - ctdb_send_message(ctdb, dest, 0, data); - } + incr = 1; + dest = (ctdb_get_vnn(ctdb) + incr) % num_nodes; + ctdb_send_message(ctdb, dest, 0, data); + + incr = -1; + dest = (ctdb_get_vnn(ctdb) + incr) % num_nodes; + ctdb_send_message(ctdb, dest, 0, data); } start_timer(); @@ -168,7 +164,7 @@ int main(int argc, const char *argv[]) POPT_CTDB_CMDLINE { "timelimit", 't', POPT_ARG_INT, &timelimit, 0, "timelimit", "integer" }, { "num-records", 'r', POPT_ARG_INT, &num_records, 0, "num_records", "integer" }, - { "num-msgs", 'n', POPT_ARG_INT, &num_msgs, 0, "num_msgs", "integer" }, + { NULL, 'n', POPT_ARG_INT, &num_nodes, 0, "num_nodes", "integer" }, POPT_TABLEEND }; int opt; @@ -220,12 +216,13 @@ int main(int argc, const char *argv[]) goto error; printf("Waiting for cluster\n"); - while (!cluster_ready) { + while (1) { + uint32_t recmode=1; + ctdb_ctrl_getrecmode(ctdb, timeval_zero(), CTDB_CURRENT_NODE, &recmode); + if (recmode == 0) break; event_loop_once(ev); } - ctdb_get_connected_nodes(ctdb, timeval_zero(), ctdb, &num_nodes); - bench_ring(ctdb, ev); error: diff --git a/ctdb/tests/ctdb_fetch.c b/ctdb/tests/ctdb_fetch.c index 4d761679d2..83fa9ee413 100644 --- a/ctdb/tests/ctdb_fetch.c +++ b/ctdb/tests/ctdb_fetch.c @@ -44,8 +44,7 @@ static double end_timer(void) static int timelimit = 10; static int num_records = 10; -static int num_msgs = 1; -static uint32_t num_nodes; +static int num_nodes; static int msg_count; #define TESTKEY "testkey" @@ -181,7 +180,7 @@ int main(int argc, const char *argv[]) POPT_CTDB_CMDLINE { "timelimit", 't', POPT_ARG_INT, &timelimit, 0, "timelimit", "integer" }, { "num-records", 'r', POPT_ARG_INT, &num_records, 0, "num_records", "integer" }, - { "num-msgs", 'n', POPT_ARG_INT, &num_msgs, 0, "num_msgs", "integer" }, + { NULL, 'n', POPT_ARG_INT, &num_nodes, 0, "num_nodes", "integer" }, POPT_TABLEEND }; int opt; @@ -232,12 +231,13 @@ int main(int argc, const char *argv[]) ctdb_set_message_handler(ctdb, 0, message_handler, &msg_count); printf("Waiting for cluster\n"); - while (!cluster_ready) { + while (1) { + uint32_t recmode=1; + ctdb_ctrl_getrecmode(ctdb, timeval_zero(), CTDB_CURRENT_NODE, &recmode); + if (recmode == 0) break; event_loop_once(ev); } - ctdb_get_connected_nodes(ctdb, timeval_zero(), ctdb, &num_nodes); - bench_fetch(ctdb, ev); ZERO_STRUCT(call); diff --git a/ctdb/tests/ctdbd.sh b/ctdb/tests/ctdbd.sh index e2c53b34f9..bcc9dec7dc 100755 --- a/ctdb/tests/ctdbd.sh +++ b/ctdb/tests/ctdbd.sh @@ -48,3 +48,4 @@ sleep 1 echo "All done" killall -q ctdbd +exit 0 diff --git a/ctdb/tests/fetch.sh b/ctdb/tests/fetch.sh index b5fdd1b08f..a2123a6b34 100755 --- a/ctdb/tests/fetch.sh +++ b/ctdb/tests/fetch.sh @@ -18,9 +18,10 @@ done killall -9 -q ctdb_fetch for i in `seq 1 $NUMNODES`; do - $VALGRIND bin/ctdb_fetch --socket sock.$i $* & + $VALGRIND bin/ctdb_fetch --socket sock.$i -n $NUMNODES $* & done wait echo "Shutting down" bin/ctdb shutdown -n all --socket=sock.1 +exit 0 |
