summaryrefslogtreecommitdiff
path: root/source4/torture/smbtorture.c
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2006-06-12 19:11:24 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:09:02 -0500
commit572930b1af390dcd862ea5861245f658c87d7016 (patch)
treedad0fb6c924c42c3027965c15947de82cb2c818f /source4/torture/smbtorture.c
parent9f4b56dd13e13826290474d20c96221503f4a668 (diff)
downloadsamba-572930b1af390dcd862ea5861245f658c87d7016.tar.gz
samba-572930b1af390dcd862ea5861245f658c87d7016.tar.bz2
samba-572930b1af390dcd862ea5861245f658c87d7016.zip
r16160: Fix double semicolon in ui.h
Support output in perl's Test::Harness format (smbtorture output can now be parsed by the 'prove' utility which generates statistics about how much tests failed, succeeded, skipped, etc) (This used to be commit 18fab7a22c85e360d5e4fbb0b2f97504b9a6cfc9)
Diffstat (limited to 'source4/torture/smbtorture.c')
-rw-r--r--source4/torture/smbtorture.c39
1 files changed, 37 insertions, 2 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);