summaryrefslogtreecommitdiff
path: root/lib/torture/subunit.c
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-11-16 00:55:35 +0100
committerJelmer Vernooij <jelmer@samba.org>2008-11-16 00:55:35 +0100
commitbadfac44128d64b9e1ba80603ac3835ef50f01f9 (patch)
tree67043d13c4133eef16fa0a09402cbf476ff453b9 /lib/torture/subunit.c
parentcaf0c17e247b7c66051abc9ed239506a4be6aecc (diff)
downloadsamba-badfac44128d64b9e1ba80603ac3835ef50f01f9.tar.gz
samba-badfac44128d64b9e1ba80603ac3835ef50f01f9.tar.bz2
samba-badfac44128d64b9e1ba80603ac3835ef50f01f9.zip
Move libtorture to top-level.
Diffstat (limited to 'lib/torture/subunit.c')
-rw-r--r--lib/torture/subunit.c96
1 files changed, 96 insertions, 0 deletions
diff --git a/lib/torture/subunit.c b/lib/torture/subunit.c
new file mode 100644
index 0000000000..d5ee344596
--- /dev/null
+++ b/lib/torture/subunit.c
@@ -0,0 +1,96 @@
+/*
+ Unix SMB/CIFS implementation.
+ Samba utility functions
+ Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2008
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "lib/torture/torture.h"
+
+static void subunit_init(struct torture_results *results)
+{
+ /* FIXME: register segv and bus handler */
+}
+
+static void subunit_suite_start(struct torture_context *ctx,
+ struct torture_suite *suite)
+{
+}
+
+static void subunit_print_testname(struct torture_context *ctx,
+ struct torture_tcase *tcase,
+ struct torture_test *test)
+{
+ if (!strcmp(tcase->name, test->name)) {
+ printf("%s", test->name);
+ } else {
+ printf("%s.%s", tcase->name, test->name);
+ }
+}
+
+static void subunit_test_start(struct torture_context *ctx,
+ struct torture_tcase *tcase,
+ struct torture_test *test)
+{
+ printf("test: ");
+ subunit_print_testname(ctx, tcase, test);
+ printf("\n");
+}
+
+static void subunit_test_result(struct torture_context *context,
+ enum torture_result res, const char *reason)
+{
+ switch (res) {
+ case TORTURE_OK:
+ printf("success: ");
+ break;
+ case TORTURE_FAIL:
+ printf("failure: ");
+ break;
+ case TORTURE_ERROR:
+ printf("error: ");
+ break;
+ case TORTURE_SKIP:
+ printf("skip: ");
+ break;
+ }
+ subunit_print_testname(context, context->active_tcase, context->active_test);
+
+ if (reason)
+ printf(" [\n%s\n]", reason);
+ printf("\n");
+}
+
+static void subunit_comment(struct torture_context *test,
+ const char *comment)
+{
+ fprintf(stderr, "%s", comment);
+}
+
+static void subunit_warning(struct torture_context *test,
+ const char *comment)
+{
+ fprintf(stderr, "WARNING!: %s\n", comment);
+}
+
+const struct torture_ui_ops torture_subunit_ui_ops = {
+ .init = subunit_init,
+ .comment = subunit_comment,
+ .warning = subunit_warning,
+ .test_start = subunit_test_start,
+ .test_result = subunit_test_result,
+ .suite_start = subunit_suite_start
+};