r24851: Add --load-module argument to smbtorture.
authorJelmer Vernooij <jelmer@samba.org>
Fri, 31 Aug 2007 18:35:30 +0000 (18:35 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 20:03:19 +0000 (15:03 -0500)
(This used to be commit 76a713b6786e22b810937289b3e7cc6700a0b49d)

source4/samba4-knownfail
source4/torture/smbtorture.c
source4/torture/torture.c
source4/torture/ui.h

index b8f82b96426d58cbc8afbb4f55087f6d5d46f9c4..2290958579215a3fa897dd9ea84c46b383a8df2c 100644 (file)
@@ -27,3 +27,4 @@ RPC-NETLOGON.*/LogonControl2
 RPC-NETLOGON.*/GetAnyDCName
 RPC-NETLOGON.*/DsrEnumerateDomainTrusts
 RPC-NETLOGON.*/DsrGetDcSiteCoverageW
 RPC-NETLOGON.*/GetAnyDCName
 RPC-NETLOGON.*/DsrEnumerateDomainTrusts
 RPC-NETLOGON.*/DsrGetDcSiteCoverageW
+RPC-DRSUAPI.*/DsReplicaUpdateRefs
index d461828431e7f9cd267d1015a7b5a259ac8c4f2c..89e13b0645291da126456bda1c8e7d8bf679355e 100644 (file)
@@ -238,6 +238,11 @@ static void usage(poptContext pc)
 
        printf("Tests are:");
 
 
        printf("Tests are:");
 
+       if (torture_root == NULL) {
+           printf("NO TESTS LOADED\n");
+           exit(1);
+       }
+
        for (o = torture_root->children; o; o = o->next) {
                printf("\n%s (%s):\n  ", o->description, o->name);
 
        for (o = torture_root->children; o; o = o->next) {
                printf("\n%s (%s):\n  ", o->description, o->name);
 
@@ -480,6 +485,7 @@ int main(int argc,char *argv[])
        int shell = False;
        static const char *ui_ops_name = "simple";
        const char *basedir = NULL;
        int shell = False;
        static const char *ui_ops_name = "simple";
        const char *basedir = NULL;
+       const char *extra_module = NULL;
        static int list_tests = 0;
        char *host = NULL, *share = NULL;
        enum {OPT_LOADFILE=1000,OPT_UNCLIST,OPT_TIMELIMIT,OPT_DNS, OPT_LIST,
        static int list_tests = 0;
        char *host = NULL, *share = NULL;
        enum {OPT_LOADFILE=1000,OPT_UNCLIST,OPT_TIMELIMIT,OPT_DNS, OPT_LIST,
@@ -502,6 +508,7 @@ int main(int argc,char *argv[])
                {"parse-dns",   'D', POPT_ARG_STRING,   NULL,   OPT_DNS,        "parse-dns",    NULL},
                {"dangerous",   'X', POPT_ARG_NONE,     NULL,   OPT_DANGEROUS,
                 "run dangerous tests (eg. wiping out password database)", NULL},
                {"parse-dns",   'D', POPT_ARG_STRING,   NULL,   OPT_DNS,        "parse-dns",    NULL},
                {"dangerous",   'X', POPT_ARG_NONE,     NULL,   OPT_DANGEROUS,
                 "run dangerous tests (eg. wiping out password database)", NULL},
+               {"load-module",  0,  POPT_ARG_STRING, &extra_module,     0, "load tests from DSO file",    "SOFILE"},
                {"shell",               0, POPT_ARG_NONE, &shell, True, "Run shell", NULL},
                {"target",              'T', POPT_ARG_STRING, &target, 0, "samba3|samba4|other", NULL},
                {"async",       'a', POPT_ARG_NONE,     NULL,   OPT_ASYNC,
                {"shell",               0, POPT_ARG_NONE, &shell, True, "Run shell", NULL},
                {"target",              'T', POPT_ARG_STRING, &target, 0, "samba3|samba4|other", NULL},
                {"async",       'a', POPT_ARG_NONE,     NULL,   OPT_ASYNC,
@@ -572,9 +579,24 @@ int main(int argc,char *argv[])
                alarm(max_runtime);
        }
 
                alarm(max_runtime);
        }
 
-       torture_init();
        ldb_global_init();
 
        ldb_global_init();
 
+       if (extra_module != NULL) {
+           init_module_fn fn = load_module(talloc_autofree_context(), poptGetOptArg(pc));
+
+           if (fn == NULL) 
+               d_printf("Unable to load module from %s\n", poptGetOptArg(pc));
+           else {
+               status = fn();
+               if (NT_STATUS_IS_ERR(status)) {
+                   d_printf("Error initializing module %s: %s\n", 
+                            poptGetOptArg(pc), nt_errstr(status));
+               }
+           }
+       } else { 
+               torture_init();
+       }
+
        if (list_tests) {
                print_test_list();
                return 0;
        if (list_tests) {
                print_test_list();
                return 0;
index 9231fe45edd2e030062efe3b097b8466eb4cef4c..803e0c6bd7868e711c680377da97519797cd7cba 100644 (file)
@@ -32,13 +32,16 @@ _PUBLIC_ int torture_failures=1;
 _PUBLIC_ int torture_seed=0;
 _PUBLIC_ int torture_numasync=100;
 
 _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;
 
 
 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);
 }
 
        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");
 
        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);
 
        run_init_functions(static_init);
        run_init_functions(shared_init);
 
index 289fad59304ffb3394854df573fa9041cfd26b73..71c21223159045bc36cbd89879d2090a436779cb 100644 (file)
@@ -87,7 +87,7 @@ struct torture_context
 
        bool returncode;
 
 
        bool returncode;
 
-       char *outputdir;
+       const char *outputdir;
        int level;
        struct event_context *ev;
 };
        int level;
        struct event_context *ev;
 };