From 4c747e59d87df01e27602413d9ddda898fedb777 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 1 Aug 2005 01:52:01 +0000 Subject: [PATCH] r8879: more expansion of the irpc test to try to uncover the ia64 mystery (This used to be commit ff03b8148bdf7798af4e1704aba22635bb67cbe4) --- source4/torture/local/irpc.c | 50 ++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/source4/torture/local/irpc.c b/source4/torture/local/irpc.c index b6df141fdf1..500a0fe02ee 100644 --- a/source4/torture/local/irpc.c +++ b/source4/torture/local/irpc.c @@ -42,6 +42,16 @@ static NTSTATUS irpc_AddOne(struct irpc_message *irpc, struct echo_AddOne *r) return NT_STATUS_OK; } +/* + serve up EchoData over the irpc system +*/ +static NTSTATUS irpc_EchoData(struct irpc_message *irpc, struct echo_EchoData *r) +{ + r->out.out_data = talloc_memdup(r, r->in.in_data, r->in.len); + NT_STATUS_HAVE_NO_MEMORY(r->out.out_data); + return NT_STATUS_OK; +} + /* test a addone call over the internal messaging system @@ -77,6 +87,42 @@ static BOOL test_addone(TALLOC_CTX *mem_ctx, return True; } +/* + test a echodata call over the internal messaging system +*/ +static BOOL test_echodata(TALLOC_CTX *mem_ctx, + struct messaging_context *msg_ctx1, + struct messaging_context *msg_ctx2) +{ + struct echo_EchoData r; + NTSTATUS status; + + /* make the call */ + r.in.in_data = talloc_strdup(mem_ctx, "0123456789"); + r.in.len = strlen(r.in.in_data); + + status = IRPC_CALL(msg_ctx1, MSG_ID2, rpcecho, ECHO_ECHODATA, &r); + if (!NT_STATUS_IS_OK(status)) { + printf("EchoData failed - %s\n", nt_errstr(status)); + return False; + } + + /* check the answer */ + if (memcmp(r.out.out_data, r.in.in_data, r.in.len) != 0) { + printf("EchoData wrong answer\n"); + NDR_PRINT_OUT_DEBUG(echo_EchoData, &r); + return False; + } + + printf("Echo '%*.*s' -> '%*.*s'\n", + r.in.len, r.in.len, + r.in.in_data, + r.in.len, r.in.len, + r.out.out_data); + + return True; +} + static void irpc_callback(struct irpc_request *irpc) { @@ -169,11 +215,15 @@ BOOL torture_local_irpc(void) IRPC_REGISTER(msg_ctx1, rpcecho, ECHO_ADDONE, irpc_AddOne, NULL); IRPC_REGISTER(msg_ctx2, rpcecho, ECHO_ADDONE, irpc_AddOne, NULL); + IRPC_REGISTER(msg_ctx1, rpcecho, ECHO_ECHODATA, irpc_EchoData, NULL); + IRPC_REGISTER(msg_ctx2, rpcecho, ECHO_ECHODATA, irpc_EchoData, NULL); + ret &= test_addone(mem_ctx, msg_ctx1, msg_ctx2, 0); ret &= test_addone(mem_ctx, msg_ctx1, msg_ctx2, 0x7FFFFFFE); ret &= test_addone(mem_ctx, msg_ctx1, msg_ctx2, 0xFFFFFFFE); ret &= test_addone(mem_ctx, msg_ctx1, msg_ctx2, 0xFFFFFFFF); ret &= test_addone(mem_ctx, msg_ctx1, msg_ctx2, random() & 0xFFFFFFFF); + ret &= test_echodata(mem_ctx, msg_ctx1, msg_ctx2); ret &= test_speed(mem_ctx, msg_ctx1, msg_ctx2, ev); talloc_free(mem_ctx); -- 2.34.1