summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorRafal Szczesniak <mimir@samba.org>2006-05-05 09:52:12 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:05:37 -0500
commit9604b161add82ed4e9039b81c59235ea678defca (patch)
tree9fc6ebabeb1dbf35e2e7d66c19ac9aa573b6c5ae /source4/torture
parentb2154e79b127d655a9ad875f7d4fd6e21cb1d8b8 (diff)
downloadsamba-9604b161add82ed4e9039b81c59235ea678defca.tar.gz
samba-9604b161add82ed4e9039b81c59235ea678defca.tar.bz2
samba-9604b161add82ed4e9039b81c59235ea678defca.zip
r15456: Inspired by a short discussion with abartlet on IRC.
- create "async" parameter for smbtorture to categorise async tests potentially hard for windows servers - create "num-async" parameter to specify the number of simultaneous async requests to be made - move RPC-ASYNCBIND test from "dangerous" to "async" (I should probably do the same for many others async tests...) It's an interesting way to determine resources availability on windows servers... rafal (This used to be commit 0d008fbea0aec279d389cff676a4319262475d17)
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/rpc/async_bind.c31
-rw-r--r--source4/torture/smbtorture.c12
-rw-r--r--source4/torture/torture.c1
-rw-r--r--source4/torture/torture.h1
4 files changed, 34 insertions, 11 deletions
diff --git a/source4/torture/rpc/async_bind.c b/source4/torture/rpc/async_bind.c
index 960f099c9b..aeac909e9d 100644
--- a/source4/torture/rpc/async_bind.c
+++ b/source4/torture/rpc/async_bind.c
@@ -24,6 +24,7 @@
#include "includes.h"
#include "torture/torture.h"
#include "lib/events/events.h"
+#include "libcli/composite/composite.h"
#include "librpc/gen_ndr/ndr_lsa.h"
#include "lib/cmdline/popt_common.h"
#include "librpc/rpc/dcerpc.h"
@@ -43,23 +44,30 @@ BOOL torture_async_bind(struct torture_context *torture)
int i;
const char *binding_string;
struct cli_credentials *creds;
+ extern int torture_numasync;
-#define ASYNC_COUNT 100
- struct composite_context *bind_req[ASYNC_COUNT];
- struct dcerpc_pipe *pipe[ASYNC_COUNT];
- struct dcerpc_interface_table *table[ASYNC_COUNT];
+ struct composite_context **bind_req;
+ struct dcerpc_pipe **pipe;
+ const struct dcerpc_interface_table **table;
- if (!lp_parm_bool(-1, "torture", "dangerous", False)) {
+ if (!lp_parm_bool(-1, "torture", "async", False)) {
printf("async bind test disabled - enable dangerous tests to use\n");
return True;
}
-
+
binding_string = lp_parm_string(-1, "torture", "binding");
/* talloc context */
mem_ctx = talloc_init("torture_async_bind");
if (mem_ctx == NULL) return False;
+ bind_req = talloc_array(torture, struct composite_context*, torture_numasync);
+ if (bind_req == NULL) return False;
+ pipe = talloc_array(torture, struct dcerpc_pipe*, torture_numasync);
+ if (pipe == NULL) return False;
+ table = talloc_array(torture, const struct dcerpc_interface_table*, torture_numasync);
+ if (table == NULL) return False;
+
/* event context */
evt_ctx = event_context_init(mem_ctx);
if (evt_ctx == NULL) return False;
@@ -67,15 +75,20 @@ BOOL torture_async_bind(struct torture_context *torture)
/* credentials */
creds = cmdline_credentials;
- for (i = 0; i < ASYNC_COUNT; i++) {
+ /* send bind requests */
+ for (i = 0; i < torture_numasync; i++) {
table[i] = &dcerpc_table_lsarpc;
bind_req[i] = dcerpc_pipe_connect_send(mem_ctx, &pipe[i], binding_string,
table[i], creds, evt_ctx);
}
- for (i = 0; i < ASYNC_COUNT; i++) {
+ /* recv bind requests */
+ for (i = 0; i < torture_numasync; i++) {
status = dcerpc_pipe_connect_recv(bind_req[i], mem_ctx, &pipe[i]);
- if (!NT_STATUS_IS_OK(status)) return False;
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("async rpc connection failed: %s\n", nt_errstr(status));
+ return False;
+ }
}
talloc_free(mem_ctx);
diff --git a/source4/torture/smbtorture.c b/source4/torture/smbtorture.c
index 22e69120df..271444ed9c 100644
--- a/source4/torture/smbtorture.c
+++ b/source4/torture/smbtorture.c
@@ -265,7 +265,7 @@ const static struct torture_ui_ops std_ui_ops = {
char **argv_new;
poptContext pc;
enum {OPT_LOADFILE=1000,OPT_UNCLIST,OPT_TIMELIMIT,OPT_DNS,
- OPT_DANGEROUS,OPT_SMB_PORTS};
+ OPT_DANGEROUS,OPT_SMB_PORTS,OPT_ASYNC};
struct poptOption long_options[] = {
POPT_AUTOHELP
@@ -281,7 +281,12 @@ const static struct torture_ui_ops std_ui_ops = {
{"timelimit", 't', POPT_ARG_STRING, NULL, OPT_TIMELIMIT, "timelimit", NULL},
{"failures", 'f', POPT_ARG_INT, &torture_failures, 0, "failures", NULL},
{"parse-dns", 'D', POPT_ARG_STRING, NULL, OPT_DNS, "parse-dns", NULL},
- {"dangerous", 'X', POPT_ARG_NONE, NULL, OPT_DANGEROUS, "dangerous", NULL},
+ {"dangerous", 'X', POPT_ARG_NONE, NULL, OPT_DANGEROUS,
+ "run dangerous tests (eg. wiping out password database)", NULL},
+ {"async", 'a', POPT_ARG_NONE, NULL, OPT_ASYNC,
+ "run async tests", NULL},
+ {"num-async", 0, POPT_ARG_INT, &torture_numasync, 0,
+ "number of simultaneous async requests", NULL},
{"maximum-runtime", 0, POPT_ARG_INT, &max_runtime, 0,
"set maximum time for smbtorture to live", "seconds"},
POPT_COMMON_SAMBA
@@ -320,6 +325,9 @@ const static struct torture_ui_ops std_ui_ops = {
case OPT_DANGEROUS:
lp_set_cmdline("torture:dangerous", "Yes");
break;
+ case OPT_ASYNC:
+ lp_set_cmdline("torture:async", "Yes");
+ break;
case OPT_SMB_PORTS:
lp_set_cmdline("smb ports", poptGetOptArg(pc));
break;
diff --git a/source4/torture/torture.c b/source4/torture/torture.c
index 9852d886f8..e4470991a4 100644
--- a/source4/torture/torture.c
+++ b/source4/torture/torture.c
@@ -55,6 +55,7 @@ _PUBLIC_ int torture_numops=10;
_PUBLIC_ int torture_entries=1000;
_PUBLIC_ int torture_failures=1;
_PUBLIC_ int torture_seed=0;
+_PUBLIC_ int torture_numasync=100;
_PUBLIC_ BOOL use_oplocks;
static int procnum; /* records process count number when forking */
static struct smbcli_state *current_cli;
diff --git a/source4/torture/torture.h b/source4/torture/torture.h
index 271a9bf4a3..ce55ac037d 100644
--- a/source4/torture/torture.h
+++ b/source4/torture/torture.h
@@ -40,6 +40,7 @@ extern int torture_nprocs;
extern int torture_seed;
extern int torture_numops;
extern int torture_failures;
+extern int torture_numasync;
extern BOOL use_level_II_oplocks;
struct torture_test;