summaryrefslogtreecommitdiff
path: root/source4/torture/local
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-07-28 04:07:51 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:30:08 -0500
commit27f457e3a85b5ff19521e377ef7371f3e7463a4d (patch)
treebd2aa5eb48613e3166882c95c67ce449d68b934e /source4/torture/local
parentdf8bce7ac2ffe1d6402f61f07d54bfe568fd6ce8 (diff)
downloadsamba-27f457e3a85b5ff19521e377ef7371f3e7463a4d.tar.gz
samba-27f457e3a85b5ff19521e377ef7371f3e7463a4d.tar.bz2
samba-27f457e3a85b5ff19521e377ef7371f3e7463a4d.zip
r8818: - fix LOCAL-IRPC test for new ref-alloc semantics of irpc
- fixed return result from LOCAL-IRPC test - added timelimit support - ensure we free messages as they complete (This used to be commit ab9a5fd84b3832e752024b92d5d7e2d89b9a1df8)
Diffstat (limited to 'source4/torture/local')
-rw-r--r--source4/torture/local/irpc.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/source4/torture/local/irpc.c b/source4/torture/local/irpc.c
index 8b86ba945b..060456cf5e 100644
--- a/source4/torture/local/irpc.c
+++ b/source4/torture/local/irpc.c
@@ -46,11 +46,9 @@ static BOOL test_addone(TALLOC_CTX *mem_ctx,
{
struct echo_AddOne r;
NTSTATUS status;
- uint32_t res;
/* make the call */
r.in.in_data = random();
- r.out.out_data = &res;
status = IRPC_CALL(msg_ctx1, MSG_ID2, rpcecho, ECHO_ADDONE, &r);
if (!NT_STATUS_IS_OK(status)) {
@@ -59,13 +57,13 @@ static BOOL test_addone(TALLOC_CTX *mem_ctx,
}
/* check the answer */
- if (res != r.in.in_data + 1) {
+ if (*r.out.out_data != r.in.in_data + 1) {
printf("AddOne wrong answer - %u should be %u\n",
*r.out.out_data, r.in.in_data+1);
return False;
}
- printf("%u + 1 = %u\n", r.in.in_data, res);
+ printf("%u + 1 = %u\n", r.in.in_data, *r.out.out_data);
return True;
}
@@ -79,6 +77,7 @@ static void irpc_callback(struct irpc_request *irpc)
printf("irpc call failed - %s\n", nt_errstr(status));
}
(*pong_count)++;
+ talloc_free(irpc);
}
/*
@@ -94,15 +93,14 @@ static BOOL test_speed(TALLOC_CTX *mem_ctx,
BOOL ret = True;
struct timeval tv;
struct echo_AddOne r;
- uint32_t res;
+ int timelimit = lp_parm_int(-1, "torture", "timelimit", 10);
tv = timeval_current();
r.in.in_data = 0;
- r.out.out_data = &res;
- printf("Sending echo for 10 seconds\n");
- while (timeval_elapsed(&tv) < 10.0) {
+ printf("Sending echo for %d seconds\n", timelimit);
+ while (timeval_elapsed(&tv) < timelimit) {
struct irpc_request *irpc;
irpc = IRPC_CALL_SEND(msg_ctx1, MSG_ID2, rpcecho, ECHO_ADDONE, &r);
@@ -162,5 +160,5 @@ BOOL torture_local_irpc(void)
talloc_free(mem_ctx);
- return True;
+ return ret;
}