Author: tridge Date: 2005-08-01 01:52:01 +0000 (Mon, 01 Aug 2005) New Revision: 8879
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=8879 Log: more expansion of the irpc test to try to uncover the ia64 mystery Modified: branches/SAMBA_4_0/source/torture/local/irpc.c Changeset: Modified: branches/SAMBA_4_0/source/torture/local/irpc.c =================================================================== --- branches/SAMBA_4_0/source/torture/local/irpc.c 2005-08-01 01:39:24 UTC (rev 8878) +++ branches/SAMBA_4_0/source/torture/local/irpc.c 2005-08-01 01:52:01 UTC (rev 8879) @@ -42,7 +42,17 @@ 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,7 +87,43 @@ 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) { struct echo_AddOne *r = irpc->r; @@ -169,11 +215,15 @@ 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);
