diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2006-06-12 19:11:24 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:09:02 -0500 |
commit | 572930b1af390dcd862ea5861245f658c87d7016 (patch) | |
tree | dad0fb6c924c42c3027965c15947de82cb2c818f | |
parent | 9f4b56dd13e13826290474d20c96221503f4a668 (diff) | |
download | samba-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)
-rw-r--r-- | source4/torture/smbtorture.c | 39 | ||||
-rw-r--r-- | source4/torture/ui.h | 2 |
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); |