1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-12 09:18:10 +03:00

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 commit is contained in:
Rafal Szczesniak 2006-05-05 09:52:12 +00:00 committed by Gerald (Jerry) Carter
parent b4c378302b
commit 0d008fbea0
4 changed files with 34 additions and 11 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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;