summaryrefslogtreecommitdiff
path: root/source4/torture/locktest2.c
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-04-25 10:04:20 +0100
committerJelmer Vernooij <jelmer@samba.org>2008-04-25 10:04:20 +0100
commitcc9c4aaa8d02c4c31c9e9a4bb53e5941683fcc31 (patch)
treed0b116699dee35372ed335834989e1c885e8f94a /source4/torture/locktest2.c
parentd1432d617e6ed04c33ca214d7f3b0099bdf53065 (diff)
parent240d959005f5fd80a38b3734b39dd5d6e425a566 (diff)
downloadsamba-cc9c4aaa8d02c4c31c9e9a4bb53e5941683fcc31.tar.gz
samba-cc9c4aaa8d02c4c31c9e9a4bb53e5941683fcc31.tar.bz2
samba-cc9c4aaa8d02c4c31c9e9a4bb53e5941683fcc31.zip
Merge branch 'v4-0-test' of ssh://git.samba.org/data/git/samba into v4-0-gmake3
Conflicts: source/Makefile source/auth/config.mk source/auth/gensec/config.mk source/build/m4/public.m4 source/build/make/python.mk source/build/make/rules.mk source/build/smb_build/header.pm source/build/smb_build/main.pl source/build/smb_build/makefile.pm source/dsdb/config.mk source/dsdb/samdb/ldb_modules/config.mk source/kdc/config.mk source/lib/events/config.mk source/lib/events/events.c source/lib/ldb/config.mk source/lib/nss_wrapper/config.mk source/lib/policy/config.mk source/lib/util/config.mk source/libcli/smb2/config.mk source/libnet/config.mk source/librpc/config.mk source/nbt_server/config.mk source/ntptr/ntptr_base.c source/ntvfs/posix/config.mk source/ntvfs/sysdep/config.mk source/param/config.mk source/rpc_server/config.mk source/rpc_server/service_rpc.c source/scripting/ejs/config.mk source/scripting/python/config.mk source/smb_server/config.mk source/smbd/server.c source/torture/config.mk source/torture/smb2/config.mk source/wrepl_server/config.mk (This used to be commit 13bbd420681519894a4036729c43273912c9b402)
Diffstat (limited to 'source4/torture/locktest2.c')
-rw-r--r--source4/torture/locktest2.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/source4/torture/locktest2.c b/source4/torture/locktest2.c
index 0fe3725385..1784a0a729 100644
--- a/source4/torture/locktest2.c
+++ b/source4/torture/locktest2.c
@@ -19,6 +19,7 @@
#include "includes.h"
#include "system/passwd.h"
+#include "lib/events/events.h"
static fstring password;
static fstring username;
@@ -137,7 +138,8 @@ static bool try_unlock(struct smbcli_state *c, int fstype,
return a connection to a server
*******************************************************/
static struct smbcli_state *connect_one(char *share, const char **ports,
- struct smb_options *options)
+ struct smb_options *optionsi,
+ struct event_context *ev)
{
struct smbcli_state *c;
char *server_n;
@@ -165,7 +167,7 @@ static struct smbcli_state *connect_one(char *share, const char **ports,
nt_status = smbcli_full_connection(NULL,
&c, myname, server_n, ports, share, NULL,
- username, lp_workgroup(), password, NULL,
+ username, lp_workgroup(), password, ev,
options);
if (!NT_STATUS_IS_OK(nt_status)) {
DEBUG(0, ("smbcli_full_connection failed with error %s\n", nt_errstr(nt_status)));
@@ -183,6 +185,7 @@ static void reconnect(struct smbcli_state *cli[NSERVERS][NCONNECTIONS],
int fnum[NSERVERS][NUMFSTYPES][NCONNECTIONS][NFILES],
const char **ports,
struct smbcli_options *options,
+ struct event_context *ev,
char *share1, char *share2)
{
int server, conn, f, fstype;
@@ -201,7 +204,7 @@ static void reconnect(struct smbcli_state *cli[NSERVERS][NCONNECTIONS],
smbcli_ulogoff(cli[server][conn]);
talloc_free(cli[server][conn]);
}
- cli[server][conn] = connect_one(share[server], ports, options);
+ cli[server][conn] = connect_one(share[server], ports, options, ev);
if (!cli[server][conn]) {
DEBUG(0,("Failed to connect to %s\n", share[server]));
exit(1);
@@ -347,7 +350,11 @@ static int retest(struct smbcli_state *cli[NSERVERS][NCONNECTIONS],
we then do random locking ops in tamdem on the 4 fnums from each
server and ensure that the results match
*/
-static void test_locks(char *share1, char *share2, char *nfspath1, char *nfspath2, const char **ports, struct smbcli_options *options)
+static void test_locks(char *share1, char *share2,
+ char *nfspath1, char *nfspath2,
+ const char **ports,
+ struct smbcli_options *options,
+ struct event_context *ev)
{
struct smbcli_state *cli[NSERVERS][NCONNECTIONS];
char *nfs[NSERVERS];
@@ -376,7 +383,7 @@ static void test_locks(char *share1, char *share2, char *nfspath1, char *nfspath
recorded[n].needed = true;
}
- reconnect(cli, nfs, fnum, ports, options, share1, share2);
+ reconnect(cli, nfs, fnum, ports, options, ev, share1, share2);
open_files(cli, nfs, fnum);
n = retest(cli, nfs, fnum, numops);
@@ -387,7 +394,7 @@ static void test_locks(char *share1, char *share2, char *nfspath1, char *nfspath
n1 = n;
close_files(cli, nfs, fnum);
- reconnect(cli, nfs, fnum, ports, options, share1, share2);
+ reconnect(cli, nfs, fnum, ports, options, ev, share1, share2);
open_files(cli, nfs, fnum);
for (i=0;i<n-1;i++) {
@@ -414,7 +421,7 @@ static void test_locks(char *share1, char *share2, char *nfspath1, char *nfspath
}
close_files(cli, nfs, fnum);
- reconnect(cli, nfs, fnum, ports, options, share1, share2);
+ reconnect(cli, nfs, fnum, ports, options, ev, share1, share2);
open_files(cli, nfs, fnum);
showall = true;
n1 = retest(cli, nfs, fnum, n);
@@ -466,6 +473,7 @@ static void usage(void)
char *p;
int seed;
struct loadparm_context *lp_ctx;
+ struct event_context *ev;
setlinebuf(stdout);
@@ -542,10 +550,12 @@ static void usage(void)
DEBUG(0,("seed=%u\n", seed));
srandom(seed);
+ ev = event_context_init(talloc_autofree_context());
+
locking_init(1);
lp_smbcli_options(lp_ctx, &options);
test_locks(share1, share2, nfspath1, nfspath2, lp_smb_ports(lp_ctx),
- &options);
+ &options, ev);
return(0);
}