r14524: Make TORTURE_NET a separate module
authorJelmer Vernooij <jelmer@samba.org>
Fri, 17 Mar 2006 16:45:24 +0000 (16:45 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:57:36 +0000 (13:57 -0500)
Add new header for torture utility functions, so torture.h doesn't
need to depend on the SMB libraries

source/torture/config.mk
source/torture/libnet/libnet.c [new file with mode: 0644]
source/torture/torture.c
source/torture/torture.h
source/torture/torture_util.c

index af8069909312662a12f13e0ce35c6ea137353112..5de3692f0581b8748776451efdbdf25faffcd328 100644 (file)
@@ -3,9 +3,9 @@
 PUBLIC_HEADERS = torture.h
 PUBLIC_PROTO_HEADER = proto.h
 OBJ_FILES = \
-               torture.o \
-               torture_util.o
+               torture.o
 REQUIRED_SUBSYSTEMS = \
+               TORTURE_UTIL \
                TORTURE_RAW \
                TORTURE_SMB2 \
                TORTURE_RAP \
@@ -14,10 +14,13 @@ REQUIRED_SUBSYSTEMS = \
                TORTURE_NBENCH \
                TORTURE_LDAP \
                TORTURE_NBT \
-               TORTURE_NET \
                CONFIG \
                LIBBASIC
 
+[SUBSYSTEM::TORTURE_UTIL]
+OBJ_FILES = torture_util.o
+PUBLIC_PROTO_HEADER = util.h
+
 #################################
 # Start SUBSYSTEM TORTURE_BASIC
 [MODULE::TORTURE_BASIC]
@@ -146,7 +149,7 @@ REQUIRED_SUBSYSTEMS = \
                RPC_NDR_MGMT RPC_NDR_NETLOGON RPC_NDR_ATSVC RPC_NDR_DRSUAPI \
                RPC_NDR_LSA RPC_NDR_EPMAPPER RPC_NDR_DFS RPC_NDR_SPOOLSS \
                RPC_NDR_SRVSVC RPC_NDR_WKSSVC RPC_NDR_ROT RPC_NDR_DSSETUP \
-               RPC_NDR_REMACT RPC_NDR_OXIDRESOLVER WB_HELPER 
+               RPC_NDR_REMACT RPC_NDR_OXIDRESOLVER WB_HELPER LIBNET
 
 #################################
 # Start SUBSYSTEM TORTURE_RAP
@@ -221,10 +224,13 @@ REQUIRED_SUBSYSTEMS = \
 
 #################################
 # Start SUBSYSTEM TORTURE_NET
-[SUBSYSTEM::TORTURE_NET]
+[MODULE::TORTURE_NET]
+SUBSYSTEM = torture
+INIT_FUNCTION = torture_net_init
 PRIVATE_PROTO_HEADER = \
                libnet/proto.h
 OBJ_FILES = \
+               libnet/libnet.o \
                libnet/userinfo.o \
                libnet/userman.o \
                libnet/domain.o \
diff --git a/source/torture/libnet/libnet.c b/source/torture/libnet/libnet.c
new file mode 100644 (file)
index 0000000..11084a3
--- /dev/null
@@ -0,0 +1,41 @@
+/* 
+   Unix SMB/CIFS implementation.
+   SMB torture tester
+   Copyright (C) Jelmer Vernooij 2006
+   
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+   
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+   
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "includes.h"
+#include "torture/torture.h"
+#include "torture/libnet/proto.h"
+
+NTSTATUS torture_net_init(void)
+{
+       register_torture_op("NET-USERINFO", torture_userinfo, 0);
+       register_torture_op("NET-USERADD", torture_useradd, 0);
+       register_torture_op("NET-USERDEL", torture_userdel, 0);
+       register_torture_op("NET-USERMOD", torture_usermod, 0);
+       register_torture_op("NET-DOMOPEN", torture_domainopen, 0);
+       register_torture_op("NET-API-LOOKUP", torture_lookup, 0);
+       register_torture_op("NET-API-LOOKUPHOST", torture_lookup_host, 0);
+       register_torture_op("NET-API-LOOKUPPDC", torture_lookup_pdc, 0);
+       register_torture_op("NET-API-CREATEUSER", torture_createuser, 0);
+       register_torture_op("NET-API-RPCCONNECT", torture_rpc_connect, 0);
+       register_torture_op("NET-API-LISTSHARES", torture_listshares, 0);
+       register_torture_op("NET-API-DELSHARE", torture_delshare, 0);
+
+       return NT_STATUS_OK;
+}
index a54c760dc851abcdb21a82cca85c6160dff26a04..4627164bef89dca607d24f52c511a2edafa1abb2 100644 (file)
@@ -45,6 +45,7 @@
 #include "torture/nbt/proto.h"
 #include "torture/libnet/proto.h"
 #include "torture/torture.h"
+#include "torture/util.h"
 #include "build.h"
 #include "dlinklist.h"
 
@@ -56,10 +57,10 @@ _PUBLIC_ int torture_seed=0;
 _PUBLIC_ BOOL use_oplocks;
 static int procnum; /* records process count number when forking */
 static struct smbcli_state *current_cli;
-static BOOL use_level_II_oplocks;
-
+_PUBLIC_ BOOL use_level_II_oplocks;
 _PUBLIC_ BOOL torture_showall = False;
 
+
 BOOL torture_open_connection_share(TALLOC_CTX *mem_ctx,
                                   struct smbcli_state **c, 
                                   const char *hostname, 
@@ -135,6 +136,7 @@ _PUBLIC_ BOOL check_error(const char *location, struct smbcli_state *c,
 }
 
 
+
 static BOOL wait_lock(struct smbcli_state *c, int fnum, uint32_t offset, uint32_t len)
 {
        while (NT_STATUS_IS_ERR(smbcli_lock(c->tree, fnum, offset, len, -1, WRITE_LOCK))) {
@@ -438,7 +440,7 @@ static BOOL run_maxfidtest(struct smbcli_state *cli, int dummy)
 /*
   sees what IOCTLs are supported
  */
-BOOL torture_ioctl_test(void)
+static BOOL torture_ioctl_test(void)
 {
        struct smbcli_state *cli;
        uint16_t device, function;
@@ -733,20 +735,6 @@ static struct {
        {"NBT-WINSREPLICATION-REPLICA", torture_nbt_winsreplication_replica, 0},
        {"NBT-WINSREPLICATION-OWNED", torture_nbt_winsreplication_owned, 0},
        
-       /* libnet tests */
-       {"NET-USERINFO", torture_userinfo, 0},
-       {"NET-USERADD", torture_useradd, 0},
-       {"NET-USERDEL", torture_userdel, 0},
-       {"NET-USERMOD", torture_usermod, 0},
-       {"NET-DOMOPEN", torture_domainopen, 0},
-       {"NET-API-LOOKUP", torture_lookup, 0},
-       {"NET-API-LOOKUPHOST", torture_lookup_host, 0},
-       {"NET-API-LOOKUPPDC", torture_lookup_pdc, 0},
-       {"NET-API-CREATEUSER", torture_createuser, 0},
-       {"NET-API-RPCCONNECT", torture_rpc_connect, 0},
-       {"NET-API-LISTSHARES", torture_listshares, 0},
-       {"NET-API-DELSHARE", torture_delshare, 0},
-
        {NULL, NULL, 0}};
 
 static void register_builtin_ops(void)
index 6218700ac6637889125457b9823b97be64f72215..ff7ee09d23bb1efbec9308388b19d9f6ac05a005 100644 (file)
@@ -38,6 +38,7 @@ extern int torture_nprocs;
 extern int torture_seed;
 extern int torture_numops;
 extern int torture_failures;
+extern BOOL use_level_II_oplocks;
 
 #include "libcli/libcli.h"
 #include "torture/proto.h"
index dde50f652213d743c0391b5151e9c091e744da0b..ba96731b20175b04c8e50756d5d669de1f630e01 100644 (file)
@@ -24,6 +24,8 @@
 #include "libcli/libcli.h"
 #include "system/shmem.h"
 #include "system/time.h"
+#include "lib/cmdline/popt_common.h"
+#include "torture/torture.h"
 
 
 /**