Author: jelmer
Date: 2006-10-18 10:03:30 +0000 (Wed, 18 Oct 2006)
New Revision: 19387

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19387

Log:
Exit with 0 if failures were expected

Modified:
   branches/SAMBA_4_0/source/torture/smbtorture.c
   branches/SAMBA_4_0/source/torture/torture.c
   branches/SAMBA_4_0/source/torture/ui.c
   branches/SAMBA_4_0/source/torture/ui.h


Changeset:
Modified: branches/SAMBA_4_0/source/torture/smbtorture.c
===================================================================
--- branches/SAMBA_4_0/source/torture/smbtorture.c      2006-10-18 03:34:31 UTC 
(rev 19386)
+++ branches/SAMBA_4_0/source/torture/smbtorture.c      2006-10-18 10:03:30 UTC 
(rev 19387)
@@ -517,8 +517,10 @@
 
        if (strcmp(target, "samba3") == 0) {
                lp_set_cmdline("target:samba3", "true");
+               lp_set_cmdline("torture:knownfail", "samba3-knownfail");
        } else if (strcmp(target, "samba4") == 0) {
                lp_set_cmdline("target:samba4", "true");
+               lp_set_cmdline("torture:knownfail", "samba4-knownfail");
        }
 
        if (max_runtime) {
@@ -594,8 +596,8 @@
                exit(1);
        }
 
-       torture = torture_context_init(talloc_autofree_context(), 
"KNOWN_FAILURES", 
-                                                ui_ops);
+       torture = torture_context_init(talloc_autofree_context(), 
+                               lp_parm_string(-1, "torture", "knownfail"), 
ui_ops);
 
        if (argc_new == 0) {
                printf("You must specify a test to run, or 'ALL'\n");
@@ -651,9 +653,7 @@
                }
        }
 
-       talloc_free(torture);
-
-       if (correct) {
+       if (torture->results.returncode) {
                return(0);
        } else {
                return(1);

Modified: branches/SAMBA_4_0/source/torture/torture.c
===================================================================
--- branches/SAMBA_4_0/source/torture/torture.c 2006-10-18 03:34:31 UTC (rev 
19386)
+++ branches/SAMBA_4_0/source/torture/torture.c 2006-10-18 10:03:30 UTC (rev 
19387)
@@ -54,6 +54,8 @@
                                                                                
                 torture);
        torture->ui_ops = ui_ops;
 
+       torture->results.returncode = true;
+
        return torture;
 }
 

Modified: branches/SAMBA_4_0/source/torture/ui.c
===================================================================
--- branches/SAMBA_4_0/source/torture/ui.c      2006-10-18 03:34:31 UTC (rev 
19386)
+++ branches/SAMBA_4_0/source/torture/ui.c      2006-10-18 10:03:30 UTC (rev 
19387)
@@ -142,7 +142,7 @@
                context->active_testname = talloc_strdup(context, suite->name);
 
        if (suite->path)
-               torture_subunit_run_suite(context, suite);
+               ret &= torture_subunit_run_suite(context, suite);
 
        for (tcase = suite->testcases; tcase; tcase = tcase->next) {
                ret &= torture_run_tcase(context, tcase);
@@ -206,12 +206,14 @@
                                        context->results.unexpected_errors, 
                                        talloc_reference(context, 
context->active_testname));
                context->results.errors++;
+               context->results.returncode = false;
        } else if (result == TORTURE_FAIL) {
                if (0 == str_list_match(context->active_testname, 
                                                   context->expected_failures)) 
{
                        context->results.unexpected_failures = str_list_add(
                                        context->results.unexpected_failures, 
                                        talloc_reference(context, 
context->active_testname));
+                       context->results.returncode = false;
                } 
                context->results.failed++;
        }

Modified: branches/SAMBA_4_0/source/torture/ui.h
===================================================================
--- branches/SAMBA_4_0/source/torture/ui.h      2006-10-18 03:34:31 UTC (rev 
19386)
+++ branches/SAMBA_4_0/source/torture/ui.h      2006-10-18 10:03:30 UTC (rev 
19387)
@@ -91,6 +91,8 @@
                const char **unexpected_failures;
                const char **unexpected_successes;
                const char **unexpected_errors;
+
+               bool returncode;
        } results;
 
        bool quiet; /* Whether tests should avoid writing output to stdout */

Reply via email to