r24851: Add --load-module argument to smbtorture.
[kai/samba.git] / source4 / torture / torture.c
index 9231fe45edd2e030062efe3b097b8466eb4cef4c..803e0c6bd7868e711c680377da97519797cd7cba 100644 (file)
@@ -32,13 +32,16 @@ _PUBLIC_ int torture_failures=1;
 _PUBLIC_ int torture_seed=0;
 _PUBLIC_ int torture_numasync=100;
 
-struct torture_suite *torture_root = NULL;
+struct torture_suite *torture_root;
 
 bool torture_register_suite(struct torture_suite *suite)
 {
        if (!suite)
                return true;
 
+       if (torture_root == NULL)
+               torture_root = talloc_zero(talloc_autofree_context(), struct torture_suite);
+
        return torture_suite_add_suite(torture_root, suite);
 }
 
@@ -63,9 +66,6 @@ int torture_init(void)
        init_module_fn static_init[] = STATIC_torture_MODULES;
        init_module_fn *shared_init = load_samba_modules(NULL, "torture");
 
-       torture_root = talloc_zero(talloc_autofree_context(), 
-                                  struct torture_suite);
-       
        run_init_functions(static_init);
        run_init_functions(shared_init);