r19513: Add support for recipes (using '@')
authorJelmer Vernooij <jelmer@samba.org>
Mon, 30 Oct 2006 11:34:59 +0000 (11:34 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:24:43 +0000 (14:24 -0500)
(This used to be commit dbe5e8dd8c0986e5ab55a072957048f633838157)

source4/torture/smbtorture.c

index b615dd66adf429c79768bdde7d16a807b85cb28b..b47127ff3fc94df887593a5ca575f6a882009b09 100644 (file)
@@ -425,6 +425,33 @@ const static struct torture_ui_ops quiet_ui_ops = {
        .test_result = quiet_test_result
 };
 
+void run_recipe(struct torture_context *tctx, const char *recipe)
+{
+       int numlines, i, ret;
+       char **lines;
+
+       lines = file_lines_load(recipe, &numlines, NULL);
+       if (lines == NULL) {
+               fprintf(stderr, "Unable to load file %s\n", recipe);
+               return;
+       }
+
+       for (i = 0; i < numlines; i++) {
+               int argc;
+               char **argv;
+
+               ret = poptParseArgvString(lines[i], &argc, &argv);
+               if (ret != 0) {
+                       fprintf(stderr, "Error parsing line\n");
+                       continue;
+               }
+
+               run_test(tctx, argv[0]);
+       }
+
+       talloc_free(lines);
+}
+
 void run_shell(struct torture_context *tctx)
 {
        char *cline;
@@ -523,7 +550,7 @@ int main(int argc,char *argv[])
        setlinebuf(stdout);
 
        /* we are never interested in SIGPIPE */
-       BlockSignals(true,SIGPIPE);
+       BlockSignals(true, SIGPIPE);
 
        pc = poptGetContext("smbtorture", argc, (const char **) argv, long_options, 
                            POPT_CONTEXT_KEEP_FIRST);
@@ -649,7 +676,9 @@ int main(int argc,char *argv[])
                double rate;
                int unexpected_failures;
                for (i=2;i<argc_new;i++) {
-                       if (!run_test(torture, argv_new[i])) {
+                       if (argv_new[i][0] == '@') {
+                               run_recipe(torture, argv_new[i]+1);
+                       } else if (!run_test(torture, argv_new[i])) {
                                correct = false;
                        }
                }