summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2010-04-10 21:24:33 +0200
committerJelmer Vernooij <jelmer@samba.org>2010-04-10 22:38:32 +0200
commit4fb98b6856fd0174d0f41f390e28027da636c307 (patch)
treef8c575416004dce559299c00cc33e1324deffef3
parent6b442f43bc54555c60760eced131c2d50bf72a95 (diff)
downloadsamba-4fb98b6856fd0174d0f41f390e28027da636c307.tar.gz
samba-4fb98b6856fd0174d0f41f390e28027da636c307.tar.bz2
samba-4fb98b6856fd0174d0f41f390e28027da636c307.zip
torture: Simplify torture suite running, call restricted test suite runner.
-rw-r--r--lib/torture/torture.c7
-rw-r--r--lib/torture/torture.h5
-rw-r--r--source4/torture/smbtorture.c72
3 files changed, 41 insertions, 43 deletions
diff --git a/lib/torture/torture.c b/lib/torture/torture.c
index 9adf6816b8..dcb28eefb0 100644
--- a/lib/torture/torture.c
+++ b/lib/torture/torture.c
@@ -304,6 +304,13 @@ bool torture_run_suite(struct torture_context *context,
return ret;
}
+bool torture_run_suite_restricted(struct torture_context *context,
+ struct torture_suite *suite, char **restricted)
+{
+ /* FIXME */
+ return false;
+}
+
void torture_ui_test_start(struct torture_context *context,
struct torture_tcase *tcase,
struct torture_test *test)
diff --git a/lib/torture/torture.h b/lib/torture/torture.h
index 6eb2c1593d..931937c118 100644
--- a/lib/torture/torture.h
+++ b/lib/torture/torture.h
@@ -218,6 +218,11 @@ bool torture_suite_add_suite(struct torture_suite *suite,
bool torture_run_suite(struct torture_context *context,
struct torture_suite *suite);
+/* Run the specified testsuite recursively, but only the specified
+ * tests */
+bool torture_run_suite_restricted(struct torture_context *context,
+ struct torture_suite *suite, char **restricted);
+
/* Run the specified testcase */
bool torture_run_tcase(struct torture_context *context,
struct torture_tcase *tcase);
diff --git a/source4/torture/smbtorture.c b/source4/torture/smbtorture.c
index 02a912619a..baa9afebb6 100644
--- a/source4/torture/smbtorture.c
+++ b/source4/torture/smbtorture.c
@@ -42,52 +42,34 @@ static bool run_matching(struct torture_context *torture,
bool *matched)
{
bool ret = true;
+ struct torture_suite *o;
+ struct torture_tcase *t;
- if (suite == NULL) {
- struct torture_suite *o;
-
- for (o = (torture_root == NULL?NULL:torture_root->children); o; o = o->next) {
- if (gen_fnmatch(expr, o->name) == 0) {
- *matched = true;
- reload_charcnv(torture->lp_ctx);
+ for (o = suite->children; o; o = o->next) {
+ char *name = NULL;
+ if (prefix == NULL)
+ name = talloc_strdup(torture, o->name);
+ else
+ name = talloc_asprintf(torture, "%s-%s", prefix, o->name);
+ if (gen_fnmatch(expr, name) == 0) {
+ *matched = true;
+ reload_charcnv(torture->lp_ctx);
+ torture->active_testname = name;
+ if (restricted != NULL)
+ ret &= torture_run_suite_restricted(torture, o, restricted);
+ else
ret &= torture_run_suite(torture, o);
- continue;
- }
-
- ret &= run_matching(torture, o->name, expr, restricted, o, matched);
- }
- } else {
- char *name;
- struct torture_suite *c;
- struct torture_tcase *t;
-
- for (c = suite->children; c; c = c->next) {
- asprintf(&name, "%s-%s", prefix, c->name);
-
- if (gen_fnmatch(expr, name) == 0) {
- *matched = true;
- reload_charcnv(torture->lp_ctx);
- torture->active_testname = talloc_strdup(torture, prefix);
- ret &= torture_run_suite(torture, c);
- free(name);
- continue;
- }
-
- ret &= run_matching(torture, name, expr, restricted, c, matched);
-
- free(name);
}
+ ret &= run_matching(torture, name, expr, restricted, o, matched);
+ }
- for (t = suite->testcases; t; t = t->next) {
- asprintf(&name, "%s-%s", prefix, t->name);
- if (gen_fnmatch(expr, name) == 0) {
- *matched = true;
- reload_charcnv(torture->lp_ctx);
- torture->active_testname = talloc_strdup(torture, prefix);
- ret &= torture_run_tcase(torture, t);
- talloc_free(torture->active_testname);
- }
- free(name);
+ for (t = suite->testcases; t; t = t->next) {
+ char *name = talloc_asprintf(torture, "%s-%s", prefix, t->name);
+ if (gen_fnmatch(expr, name) == 0) {
+ *matched = true;
+ reload_charcnv(torture->lp_ctx);
+ torture->active_testname = name;
+ ret &= torture_run_tcase(torture, t);
}
}
@@ -107,13 +89,17 @@ static bool run_test(struct torture_context *torture, const char *name,
struct torture_suite *o;
if (strequal(name, "ALL")) {
+ if (restricted != NULL) {
+ printf("--load-list and ALL are incompatible\n");
+ return false;
+ }
for (o = torture_root->children; o; o = o->next) {
ret &= torture_run_suite(torture, o);
}
return ret;
}
- ret = run_matching(torture, NULL, name, restricted, NULL, &matched);
+ ret = run_matching(torture, NULL, name, restricted, torture_root, &matched);
if (!matched) {
printf("Unknown torture operation '%s'\n", name);