summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/torture/smbtorture.c39
-rw-r--r--source4/torture/ui.h2
2 files changed, 38 insertions, 3 deletions
diff --git a/source4/torture/smbtorture.c b/source4/torture/smbtorture.c
index d588e124fd..97b6ab2c65 100644
--- a/source4/torture/smbtorture.c
+++ b/source4/torture/smbtorture.c
@@ -267,7 +267,7 @@ static void subunit_test_result (struct torture_test *test, enum torture_result
printf("success: %s\n", test->name);
break;
case TORTURE_FAIL:
- printf("failure: %s\n", test->name);
+ printf("failure: %s [ %s ]\n", test->name, reason);
break;
case TORTURE_TODO:
printf("todo: %s\n", test->name);
@@ -289,6 +289,39 @@ const static struct torture_ui_ops subunit_ui_ops = {
.test_result = subunit_test_result
};
+static void harness_test_start (struct torture_test *test)
+{
+}
+
+static void harness_test_result (struct torture_test *test, enum torture_result res, const char *reason)
+{
+ switch (res) {
+ case TORTURE_OK:
+ printf("ok %s - %s\n", test->name, reason);
+ break;
+ case TORTURE_FAIL:
+ printf("not ok %s - %s\n", test->name, reason);
+ break;
+ case TORTURE_TODO:
+ printf("todo %s - %s\n", test->name, reason);
+ break;
+ case TORTURE_SKIP:
+ printf("skip %s - %s\n", test->name, reason);
+ break;
+ }
+}
+
+static void harness_comment (struct torture_test *test, const char *comment)
+{
+ printf("# %s\n", comment);
+}
+
+const static struct torture_ui_ops harness_ui_ops = {
+ .comment = harness_comment,
+ .test_start = harness_test_start,
+ .test_result = harness_test_result
+};
+
/****************************************************************************
main program
****************************************************************************/
@@ -308,7 +341,7 @@ const static struct torture_ui_ops subunit_ui_ops = {
struct poptOption long_options[] = {
POPT_AUTOHELP
- {"format", 0, POPT_ARG_STRING, &ui_ops_name, 0, "Output format (one of: simple, subunit)", NULL },
+ {"format", 0, POPT_ARG_STRING, &ui_ops_name, 0, "Output format (one of: simple, subunit, harness)", NULL },
{"smb-ports", 'p', POPT_ARG_STRING, NULL, OPT_SMB_PORTS, "SMB ports", NULL},
{"seed", 0, POPT_ARG_INT, &torture_seed, 0, "seed", NULL},
{"num-progs", 0, POPT_ARG_INT, &torture_nprocs, 0, "num progs", NULL},
@@ -442,6 +475,8 @@ const static struct torture_ui_ops subunit_ui_ops = {
torture->ui_ops = &std_ui_ops;
} else if (!strcmp(ui_ops_name, "subunit")) {
torture->ui_ops = &subunit_ui_ops;
+ } else if (!strcmp(ui_ops_name, "harness")) {
+ torture->ui_ops = &harness_ui_ops;
} else {
printf("Unknown output format '%s'\n", ui_ops_name);
exit(1);
diff --git a/source4/torture/ui.h b/source4/torture/ui.h
index f115291bcd..04760d6285 100644
--- a/source4/torture/ui.h
+++ b/source4/torture/ui.h
@@ -90,5 +90,5 @@ struct torture_test *torture_test(struct torture_context *ctx, const char *name,
struct torture_test *torture_subtest(struct torture_test *parent, const char *name, const char *description);
void torture_comment(struct torture_test *test, const char *comment, ...) _PRINTF_ATTRIBUTE(2,3);
void torture_ok(struct torture_test *test);
-void torture_fail(struct torture_test *test, const char *reason, ...) _PRINTF_ATTRIBUTE(2,3);;
+void torture_fail(struct torture_test *test, const char *reason, ...) _PRINTF_ATTRIBUTE(2,3);
void torture_skip(struct torture_test *test, const char *reason, ...) _PRINTF_ATTRIBUTE(2,3);