Revert making public of the samba-module library.
[garming/samba-autobuild/.git] / source4 / torture / smbtorture.c
index 49d9b1887d1a5f5bdde034d5dd9be9c47e1d1d30..934e0a7b2fa4b06d5cd84d1f3c6f35cd967db83b 100644 (file)
@@ -32,6 +32,7 @@
 #include "librpc/rpc/dcerpc.h"
 #include "auth/gensec/gensec.h"
 #include "param/param.h"
+#include "lib/util/samba_modules.h"
 
 #if HAVE_READLINE_HISTORY_H
 #include <readline/history.h>
@@ -285,7 +286,7 @@ void torture_print_testsuites(bool structured)
        }
 }
 
-_NORETURN_ static void usage(poptContext pc)
+static void usage(poptContext pc)
 {
        poptPrintUsage(pc, stdout, 0);
        printf("\n");
@@ -341,7 +342,6 @@ _NORETURN_ static void usage(poptContext pc)
 
        print_structured_testsuite_list();
 
-       exit(1);
 }
 
 _NORETURN_ static void max_runtime_handler(int sig)
@@ -602,7 +602,7 @@ int main(int argc,char *argv[])
        }
 
        if (extra_module != NULL) {
-           init_module_fn fn = load_module(talloc_autofree_context(), poptGetOptArg(pc));
+               init_module_fn fn = load_module(poptGetOptArg(pc), false, NULL);
 
                if (fn == NULL) 
                        d_printf("Unable to load module from %s\n", poptGetOptArg(pc));
@@ -633,8 +633,12 @@ int main(int argc,char *argv[])
        }
 
        if (list_tests) {
-               for (i=1;i<argc_new;i++) {
-                       print_test_list(torture_root, NULL, argv_new[i]);
+               if (argc_new == 1) {
+                       print_test_list(torture_root, NULL, "");
+               } else {
+                       for (i=1;i<argc_new;i++) {
+                               print_test_list(torture_root, NULL, argv_new[i]);
+                       }
                }
                return 0;
        }
@@ -683,7 +687,7 @@ int main(int argc,char *argv[])
 
        torture->lp_ctx = cmdline_lp_ctx;
 
-       gensec_init(cmdline_lp_ctx);
+       gensec_init();
 
        if (shell) {
                /* In shell mode, just ignore any remaining test names. */
@@ -698,19 +702,17 @@ int main(int argc,char *argv[])
                if (argc_new < 3) {
                        printf("You must specify a test to run, or 'ALL'\n");
                        usage(pc);
-                       exit(1);
-               }
-
+                       torture->results->returncode = 1;
+               } else if (!torture_parse_target(cmdline_lp_ctx, argv_new[1])) {
                /* Take the target name or binding. */
-               if (!torture_parse_target(cmdline_lp_ctx, argv_new[1])) {
                        usage(pc);
-                       exit(1);
-               }
-
-               for (i=2;i<argc_new;i++) {
-                       if (!torture_run_named_tests(torture, argv_new[i],
-                                   (const char **)restricted)) {
-                               correct = false;
+                       torture->results->returncode = 1;
+               } else {
+                       for (i=2;i<argc_new;i++) {
+                               if (!torture_run_named_tests(torture, argv_new[i],
+                                           (const char **)restricted)) {
+                                       correct = false;
+                               }
                        }
                }
        }