summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2007-01-10 10:52:09 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:37:23 -0500
commit1cd4339b9a2786aa26691ca4f02fa93ab0958b88 (patch)
tree9b09324617e38a651de0a761b3c591fa7deff74a /source4/torture
parent848e236516ccc15864f7c3d2e05a905f6a81678e (diff)
downloadsamba-1cd4339b9a2786aa26691ca4f02fa93ab0958b88.tar.gz
samba-1cd4339b9a2786aa26691ca4f02fa93ab0958b88.tar.bz2
samba-1cd4339b9a2786aa26691ca4f02fa93ab0958b88.zip
r20646: first preparations for cluster enablement. This changes "
uint32_t server_id to struct server_id server_id; which allows a server ID to have an node number. The node number will be zero in non-clustered case. This is the most basic hook needed for clustering, and ctdb. (This used to be commit 2365abaa991d57d68c6ebe9be608e01c907102eb)
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/local/irpc.c27
-rw-r--r--source4/torture/local/messaging.c16
2 files changed, 25 insertions, 18 deletions
diff --git a/source4/torture/local/irpc.c b/source4/torture/local/irpc.c
index 185e1fb4ae..299cf77625 100644
--- a/source4/torture/local/irpc.c
+++ b/source4/torture/local/irpc.c
@@ -92,7 +92,8 @@ static bool test_addone(struct torture_context *test, const void *_data,
r.in.in_data = value;
test_debug = True;
- status = IRPC_CALL(data->msg_ctx1, MSG_ID2, rpcecho, ECHO_ADDONE, &r, test);
+ status = IRPC_CALL(data->msg_ctx1, cluster_id(MSG_ID2),
+ rpcecho, ECHO_ADDONE, &r, test);
test_debug = False;
torture_assert_ntstatus_ok(test, status, "AddOne failed");
@@ -120,8 +121,9 @@ static bool test_echodata(struct torture_context *tctx,
r.in.in_data = (unsigned char *)talloc_strdup(mem_ctx, "0123456789");
r.in.len = strlen((char *)r.in.in_data);
- status = IRPC_CALL(data->msg_ctx1, MSG_ID2, rpcecho, ECHO_ECHODATA, &r,
- mem_ctx);
+ status = IRPC_CALL(data->msg_ctx1, cluster_id(MSG_ID2),
+ rpcecho, ECHO_ECHODATA, &r,
+ mem_ctx);
torture_assert_ntstatus_ok(tctx, status, "EchoData failed");
/* check the answer */
@@ -177,8 +179,9 @@ static bool test_speed(struct torture_context *tctx,
while (timeval_elapsed(&tv) < timelimit) {
struct irpc_request *irpc;
- irpc = IRPC_CALL_SEND(data->msg_ctx1, MSG_ID2, rpcecho, ECHO_ADDONE,
- &r, mem_ctx);
+ irpc = IRPC_CALL_SEND(data->msg_ctx1, cluster_id(MSG_ID2),
+ rpcecho, ECHO_ADDONE,
+ &r, mem_ctx);
torture_assert(tctx, irpc != NULL, "AddOne send failed");
irpc->async.fn = irpc_callback;
@@ -214,11 +217,15 @@ static BOOL irpc_setup(struct torture_context *tctx, void **_data)
lp_set_cmdline("lock dir", "lockdir.tmp");
data->ev = event_context_init(tctx);
- torture_assert(tctx, data->msg_ctx1 = messaging_init(tctx, MSG_ID1, data->ev),
- "Failed to init first messaging context");
-
- torture_assert(tctx, data->msg_ctx2 = messaging_init(tctx, MSG_ID2, data->ev),
- "Failed to init second messaging context");
+ torture_assert(tctx, data->msg_ctx1 =
+ messaging_init(tctx,
+ cluster_id(MSG_ID1), data->ev),
+ "Failed to init first messaging context");
+
+ torture_assert(tctx, data->msg_ctx2 =
+ messaging_init(tctx,
+ cluster_id(MSG_ID2), data->ev),
+ "Failed to init second messaging context");
/* register the server side function */
IRPC_REGISTER(data->msg_ctx1, rpcecho, ECHO_ADDONE, irpc_AddOne, NULL);
diff --git a/source4/torture/local/messaging.c b/source4/torture/local/messaging.c
index 27c343948b..ccf091cf62 100644
--- a/source4/torture/local/messaging.c
+++ b/source4/torture/local/messaging.c
@@ -29,7 +29,7 @@
static uint32_t msg_pong;
static void ping_message(struct messaging_context *msg, void *private,
- uint32_t msg_type, uint32_t src, DATA_BLOB *data)
+ uint32_t msg_type, struct server_id src, DATA_BLOB *data)
{
NTSTATUS status;
status = messaging_send(msg, src, msg_pong, data);
@@ -39,14 +39,14 @@ static void ping_message(struct messaging_context *msg, void *private,
}
static void pong_message(struct messaging_context *msg, void *private,
- uint32_t msg_type, uint32_t src, DATA_BLOB *data)
+ uint32_t msg_type, struct server_id src, DATA_BLOB *data)
{
int *count = private;
(*count)++;
}
static void exit_message(struct messaging_context *msg, void *private,
- uint32_t msg_type, uint32_t src, DATA_BLOB *data)
+ uint32_t msg_type, struct server_id src, DATA_BLOB *data)
{
talloc_free(private);
exit(0);
@@ -71,14 +71,14 @@ static bool test_ping_speed(struct torture_context *tctx)
ev = event_context_init(mem_ctx);
- msg_server_ctx = messaging_init(mem_ctx, 1, ev);
+ msg_server_ctx = messaging_init(mem_ctx, cluster_id(1), ev);
torture_assert(tctx, msg_server_ctx != NULL, "Failed to init ping messaging context");
messaging_register_tmp(msg_server_ctx, NULL, ping_message, &msg_ping);
messaging_register_tmp(msg_server_ctx, mem_ctx, exit_message, &msg_exit);
- msg_client_ctx = messaging_init(mem_ctx, 2, ev);
+ msg_client_ctx = messaging_init(mem_ctx, cluster_id(2), ev);
torture_assert(tctx, msg_client_ctx != NULL, "msg_client_ctx messaging_init() failed");
@@ -94,8 +94,8 @@ static bool test_ping_speed(struct torture_context *tctx)
data.data = discard_const_p(uint8_t, "testing");
data.length = strlen((const char *)data.data);
- status1 = messaging_send(msg_client_ctx, 1, msg_ping, &data);
- status2 = messaging_send(msg_client_ctx, 1, msg_ping, NULL);
+ status1 = messaging_send(msg_client_ctx, cluster_id(1), msg_ping, &data);
+ status2 = messaging_send(msg_client_ctx, cluster_id(1), msg_ping, NULL);
torture_assert_ntstatus_ok(tctx, status1, "msg1 failed");
ping_count++;
@@ -115,7 +115,7 @@ static bool test_ping_speed(struct torture_context *tctx)
}
torture_comment(tctx, "sending exit");
- messaging_send(msg_client_ctx, 1, msg_exit, NULL);
+ messaging_send(msg_client_ctx, cluster_id(1), msg_exit, NULL);
torture_assert_int_equal(tctx, ping_count, pong_count, "ping test failed");