summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2006-10-18 10:03:30 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:21:23 -0500
commit1d3663c23077abab81c5a015b5c66ad0a274c882 (patch)
tree94311b617b2fcfaa48ba9d6b07ee581ad3b318eb /source4/torture
parent43aa9f86f5c574f5dac70970f574a0c0a3c4eab1 (diff)
downloadsamba-1d3663c23077abab81c5a015b5c66ad0a274c882.tar.gz
samba-1d3663c23077abab81c5a015b5c66ad0a274c882.tar.bz2
samba-1d3663c23077abab81c5a015b5c66ad0a274c882.zip
r19387: Exit with 0 if failures were expected
(This used to be commit b4fc06aeafa3ed8460759409a72b4de43a534d62)
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/smbtorture.c10
-rw-r--r--source4/torture/torture.c2
-rw-r--r--source4/torture/ui.c4
-rw-r--r--source4/torture/ui.h2
4 files changed, 12 insertions, 6 deletions
diff --git a/source4/torture/smbtorture.c b/source4/torture/smbtorture.c
index fdd44ddc08..ce05989327 100644
--- a/source4/torture/smbtorture.c
+++ b/source4/torture/smbtorture.c
@@ -517,8 +517,10 @@ const static struct torture_ui_ops quiet_ui_ops = {
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 @@ const static struct torture_ui_ops quiet_ui_ops = {
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 @@ const static struct torture_ui_ops quiet_ui_ops = {
}
}
- talloc_free(torture);
-
- if (correct) {
+ if (torture->results.returncode) {
return(0);
} else {
return(1);
diff --git a/source4/torture/torture.c b/source4/torture/torture.c
index e6629eb214..76c589fcfb 100644
--- a/source4/torture/torture.c
+++ b/source4/torture/torture.c
@@ -54,6 +54,8 @@ struct torture_context *torture_context_init(TALLOC_CTX *mem_ctx,
torture);
torture->ui_ops = ui_ops;
+ torture->results.returncode = true;
+
return torture;
}
diff --git a/source4/torture/ui.c b/source4/torture/ui.c
index 1e404d55ad..441e9ebbd7 100644
--- a/source4/torture/ui.c
+++ b/source4/torture/ui.c
@@ -142,7 +142,7 @@ BOOL torture_run_suite(struct torture_context *context,
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 @@ void torture_ui_test_result(struct torture_context *context,
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++;
}
diff --git a/source4/torture/ui.h b/source4/torture/ui.h
index 23988d9bf4..5547ecf317 100644
--- a/source4/torture/ui.h
+++ b/source4/torture/ui.h
@@ -91,6 +91,8 @@ struct torture_context
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 */