summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2006-06-12 12:24:33 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:09:01 -0500
commit482a9f046f2fa79cb154d3cf4840d0a805287890 (patch)
treef37133de9b475decfb328ecf8a5e83ee2293ab58
parentdcbd023aa033b97bb685708efe6df40c331727f3 (diff)
downloadsamba-482a9f046f2fa79cb154d3cf4840d0a805287890.tar.gz
samba-482a9f046f2fa79cb154d3cf4840d0a805287890.tar.bz2
samba-482a9f046f2fa79cb154d3cf4840d0a805287890.zip
r16152: Support multiple output formats for those tests using the ui and add support for subunit output.
(This used to be commit 4e720b01916e226071fce124363da7d68f04a511)
-rw-r--r--source4/torture/smbtorture.c46
1 files changed, 45 insertions, 1 deletions
diff --git a/source4/torture/smbtorture.c b/source4/torture/smbtorture.c
index 08aa1e4931..d588e124fd 100644
--- a/source4/torture/smbtorture.c
+++ b/source4/torture/smbtorture.c
@@ -254,6 +254,41 @@ const static struct torture_ui_ops std_ui_ops = {
.test_result = simple_test_result
};
+
+static void subunit_test_start (struct torture_test *test)
+{
+ printf("test: %s\n", test->name);
+}
+
+static void subunit_test_result (struct torture_test *test, enum torture_result res, const char *reason)
+{
+ switch (res) {
+ case TORTURE_OK:
+ printf("success: %s\n", test->name);
+ break;
+ case TORTURE_FAIL:
+ printf("failure: %s\n", test->name);
+ break;
+ case TORTURE_TODO:
+ printf("todo: %s\n", test->name);
+ break;
+ case TORTURE_SKIP:
+ printf("skip: %s\n", test->name);
+ break;
+ }
+}
+
+static void subunit_comment (struct torture_test *test, const char *comment)
+{
+ printf("# %s\n", comment);
+}
+
+const static struct torture_ui_ops subunit_ui_ops = {
+ .comment = subunit_comment,
+ .test_start = subunit_test_start,
+ .test_result = subunit_test_result
+};
+
/****************************************************************************
main program
****************************************************************************/
@@ -267,11 +302,13 @@ const static struct torture_ui_ops std_ui_ops = {
struct torture_context *torture;
char **argv_new;
poptContext pc;
+ static char *ui_ops_name = "simple";
enum {OPT_LOADFILE=1000,OPT_UNCLIST,OPT_TIMELIMIT,OPT_DNS,
OPT_DANGEROUS,OPT_SMB_PORTS,OPT_ASYNC};
struct poptOption long_options[] = {
POPT_AUTOHELP
+ {"format", 0, POPT_ARG_STRING, &ui_ops_name, 0, "Output format (one of: simple, subunit)", 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},
@@ -401,7 +438,14 @@ const static struct torture_ui_ops std_ui_ops = {
}
torture = talloc_zero(NULL, struct torture_context);
- torture->ui_ops = &std_ui_ops;
+ if (!strcmp(ui_ops_name, "simple")) {
+ torture->ui_ops = &std_ui_ops;
+ } else if (!strcmp(ui_ops_name, "subunit")) {
+ torture->ui_ops = &subunit_ui_ops;
+ } else {
+ printf("Unknown output format '%s'\n", ui_ops_name);
+ exit(1);
+ }
if (argc_new == 0) {
printf("You must specify a test to run, or 'ALL'\n");