summaryrefslogtreecommitdiff
path: root/source4/torture/rpc
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-06-16 23:28:24 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:18:18 -0500
commitdc8961ad42eedc4f9b26a93fb267e491a1e2af0e (patch)
tree2b6d612ceb0ad5a4c963eb3af2c80233200fb1d3 /source4/torture/rpc
parent4f6225d695eb721ca08ddf46d44a1594bf178358 (diff)
downloadsamba-dc8961ad42eedc4f9b26a93fb267e491a1e2af0e.tar.gz
samba-dc8961ad42eedc4f9b26a93fb267e491a1e2af0e.tar.bz2
samba-dc8961ad42eedc4f9b26a93fb267e491a1e2af0e.zip
r7656: added testing of rpc request timeouts and destruction
(This used to be commit eddf41d5e4ca43073b96f96b96dbadf7b8b91df5)
Diffstat (limited to 'source4/torture/rpc')
-rw-r--r--source4/torture/rpc/echo.c62
1 files changed, 62 insertions, 0 deletions
diff --git a/source4/torture/rpc/echo.c b/source4/torture/rpc/echo.c
index ad09e00294..94400247a6 100644
--- a/source4/torture/rpc/echo.c
+++ b/source4/torture/rpc/echo.c
@@ -383,6 +383,67 @@ static BOOL test_doublepointer(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
return ret;
}
+
+/*
+ test request timeouts
+*/
+static BOOL test_timeout(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
+{
+ NTSTATUS status;
+ struct rpc_request *req;
+ struct echo_TestSleep r;
+ int timeout_saved = p->request_timeout;
+
+ if (!lp_parm_bool(-1, "torture", "echo_TestSleep", True)) {
+ printf("timeout testing disabled - use \"torture:echo_TestSleep=yes\" to enable\n");
+ return True;
+ }
+
+ printf("testing request timeouts\n");
+ r.in.seconds = 2;
+ p->request_timeout = 1;
+
+ req = dcerpc_echo_TestSleep_send(p, mem_ctx, &r);
+ if (!req) {
+ printf("Failed to send async sleep request\n");
+ goto failed;
+ }
+
+ status = dcerpc_ndr_request_recv(req);
+ if (!NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT)) {
+ printf("request should have timed out - %s\n", nt_errstr(status));
+ goto failed;
+ }
+
+ printf("testing request destruction\n");
+ req = dcerpc_echo_TestSleep_send(p, mem_ctx, &r);
+ if (!req) {
+ printf("Failed to send async sleep request\n");
+ goto failed;
+ }
+ talloc_free(req);
+
+ req = dcerpc_echo_TestSleep_send(p, mem_ctx, &r);
+ if (!req) {
+ printf("Failed to send async sleep request\n");
+ goto failed;
+ }
+ status = dcerpc_ndr_request_recv(req);
+ if (!NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT)) {
+ printf("request should have timed out - %s\n", nt_errstr(status));
+ goto failed;
+ }
+
+
+ p->request_timeout = timeout_saved;
+ return True;
+
+failed:
+ p->request_timeout = timeout_saved;
+ return False;
+}
+
+
BOOL torture_rpc_echo(void)
{
NTSTATUS status;
@@ -411,6 +472,7 @@ BOOL torture_rpc_echo(void)
ret &= test_surrounding(p, mem_ctx);
ret &= test_doublepointer(p, mem_ctx);
ret &= test_sleep(p, mem_ctx);
+ ret &= test_timeout(p, mem_ctx);
printf("\n");