summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2016-08-02 14:36:45 +1000
committerStefan Metzmacher <metze@samba.org>2016-08-10 11:24:35 +0200
commit10e66ef4672eef6aa5d705d1e0ae772733d186c0 (patch)
treeb5f4e6ffaa97d2d345b6d09b8448edabd8d9a44a
parent88178499a528bba35f96866ab91d54005993f3b9 (diff)
downloadsamba-10e66ef4672eef6aa5d705d1e0ae772733d186c0.tar.gz
ctdb-tests: Implement --interactive/-i option in fetch ring
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12109 Pair-programmed-with: Amitay Isaacs <amitay@gmail.com> Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> (cherry picked from commit 82cffc2f5759fb73bba37e45fc20b24b30ab0438)
-rw-r--r--ctdb/tests/src/fetch_ring.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/ctdb/tests/src/fetch_ring.c b/ctdb/tests/src/fetch_ring.c
index b5a63dff188..c875aed3a28 100644
--- a/ctdb/tests/src/fetch_ring.c
+++ b/ctdb/tests/src/fetch_ring.c
@@ -43,6 +43,7 @@ struct fetch_ring_state {
struct ctdb_db_context *ctdb_db;
int num_nodes;
int timelimit;
+ int interactive;
TDB_DATA key;
int msg_count;
struct timeval start_time;
@@ -61,7 +62,8 @@ static struct tevent_req *fetch_ring_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
struct ctdb_client_context *client,
struct ctdb_db_context *ctdb_db,
- int num_nodes, int timelimit)
+ int num_nodes, int timelimit,
+ int interactive)
{
struct tevent_req *req, *subreq;
struct fetch_ring_state *state;
@@ -76,6 +78,7 @@ static struct tevent_req *fetch_ring_send(TALLOC_CTX *mem_ctx,
state->ctdb_db = ctdb_db;
state->num_nodes = num_nodes;
state->timelimit = timelimit;
+ state->interactive = interactive;
state->key.dptr = discard_const(TESTKEY);
state->key.dsize = strlen(TESTKEY);
@@ -294,7 +297,9 @@ static void fetch_ring_final_read(struct tevent_req *subreq)
return;
}
- printf("DATA:\n%s\n", (char *)data.dptr);
+ if (state->interactive == 1) {
+ printf("DATA:\n%s\n", (char *)data.dptr);
+ }
talloc_free(data.dptr);
talloc_free(h);
@@ -361,7 +366,8 @@ int main(int argc, const char *argv[])
}
req = fetch_ring_send(mem_ctx, ev, client, ctdb_db,
- opts->num_nodes, opts->timelimit);
+ opts->num_nodes, opts->timelimit,
+ opts->interactive);
if (req == NULL) {
fprintf(stderr, "Memory allocation error\n");
exit(1);