Make sure prototypes are always included, make some functions static and
[ira/wip.git] / source4 / torture / torture.c
index fbf8f8ca1d940eb6e7854024449ba879194eb709..dc98c2cc9a7f752d4e050f09b09684e148d9d998 100644 (file)
@@ -6,7 +6,7 @@
    
    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
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
    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.
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #include "includes.h"
 #include "system/time.h"
 #include "torture/torture.h"
-#include "build.h"
-#include "lib/util/dlinklist.h"
+#include "../lib/util/dlinklist.h"
+#include "param/param.h"
+#include "lib/cmdline/popt_common.h"
+#include "torture/smbtorture.h"
 
 _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 torture_showall = false;
 
 struct torture_suite *torture_root = NULL;
 
@@ -39,34 +39,30 @@ bool torture_register_suite(struct torture_suite *suite)
        if (!suite)
                return true;
 
-       return torture_suite_add_suite(torture_root, suite);
-}
-
-struct torture_context *torture_context_init(TALLOC_CTX *mem_ctx, 
-                                                                                        const char *known_failures_file, 
-                                                                                        const struct torture_ui_ops *ui_ops)
-{
-       int numlines;
-       struct torture_context *torture = talloc_zero(mem_ctx, 
-                                                                                                 struct torture_context);
-       torture->expected_failures = file_lines_load(known_failures_file, &numlines,
-                                                                                                torture);
-       torture->ui_ops = ui_ops;
-
-       torture->results.returncode = true;
+       if (torture_root == NULL)
+               torture_root = talloc_zero(talloc_autofree_context(), struct torture_suite);
 
-       return torture;
+       return torture_suite_add_suite(torture_root, suite);
 }
 
 
-int torture_init(void)
+_PUBLIC_ int torture_init(void)
 {
-       init_module_fn static_init[] = STATIC_torture_MODULES;
-       init_module_fn *shared_init = load_samba_modules(NULL, "torture");
+       extern NTSTATUS torture_base_init(void);
+       extern NTSTATUS torture_ldap_init(void);
+       extern NTSTATUS torture_local_init(void);
+       extern NTSTATUS torture_nbt_init(void);
+       extern NTSTATUS torture_nbench_init(void);
+       extern NTSTATUS torture_rap_init(void);
+       extern NTSTATUS torture_rpc_init(void);
+       extern NTSTATUS torture_smb2_init(void);
+       extern NTSTATUS torture_net_init(void);
+       extern NTSTATUS torture_raw_init(void);
+       extern NTSTATUS torture_unix_init(void);
+       extern NTSTATUS torture_winbind_init(void);
+       init_module_fn static_init[] = { STATIC_smbtorture_MODULES };
+       init_module_fn *shared_init = load_samba_modules(NULL, cmdline_lp_ctx, "torture");
 
-       torture_root = talloc_zero(talloc_autofree_context(), 
-                                                       struct torture_suite);
-       
        run_init_functions(static_init);
        run_init_functions(shared_init);