summaryrefslogtreecommitdiff
path: root/lib/torture
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2010-09-22 19:55:58 -0700
committerJelmer Vernooij <jelmer@samba.org>2010-09-22 22:29:09 -0700
commit029add7e079cc9532016b49c323b52eadef25695 (patch)
tree2159c069fdb0655823c3b7e937057e9944ab009e /lib/torture
parent20c95cf6856b7d18784e8429d1ba31443a883d49 (diff)
downloadsamba-029add7e079cc9532016b49c323b52eadef25695.tar.gz
samba-029add7e079cc9532016b49c323b52eadef25695.tar.bz2
samba-029add7e079cc9532016b49c323b52eadef25695.zip
smbtorture: Use subunit C library.
Diffstat (limited to 'lib/torture')
-rw-r--r--lib/torture/subunit.c52
-rw-r--r--lib/torture/wscript_build3
2 files changed, 27 insertions, 28 deletions
diff --git a/lib/torture/subunit.c b/lib/torture/subunit.c
index 6c58cfef76..0b63cca053 100644
--- a/lib/torture/subunit.c
+++ b/lib/torture/subunit.c
@@ -19,69 +19,67 @@
#include "includes.h"
#include "lib/torture/torture.h"
+#include <subunit/child.h>
-static void subunit_suite_start(struct torture_context *ctx,
+static void torture_subunit_suite_start(struct torture_context *ctx,
struct torture_suite *suite)
{
}
-static void subunit_print_testname(struct torture_context *ctx,
+static char *torture_subunit_test_name(struct torture_context *ctx,
struct torture_tcase *tcase,
struct torture_test *test)
{
if (!strcmp(tcase->name, test->name)) {
- printf("%s", test->name);
+ return talloc_strdup(ctx, test->name);
} else {
- printf("%s.%s", tcase->name, test->name);
+ return talloc_asprintf(ctx, "%s.%s", tcase->name, test->name);
}
}
-static void subunit_test_start(struct torture_context *ctx,
+static void torture_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");
+ char *fullname = torture_subunit_test_name(ctx, ctx->active_tcase, ctx->active_test);
+ subunit_test_start(fullname);
+ talloc_free(fullname);
}
-static void subunit_test_result(struct torture_context *context,
+static void torture_subunit_test_result(struct torture_context *context,
enum torture_result res, const char *reason)
{
+ char *fullname = torture_subunit_test_name(context, context->active_tcase, context->active_test);
switch (res) {
case TORTURE_OK:
- printf("success: ");
+ subunit_test_pass(fullname);
break;
case TORTURE_FAIL:
- printf("failure: ");
+ subunit_test_fail(fullname, reason);
break;
case TORTURE_ERROR:
- printf("error: ");
+ subunit_test_error(fullname, reason);
break;
case TORTURE_SKIP:
- printf("skip: ");
+ subunit_test_skip(fullname, reason);
break;
}
- subunit_print_testname(context, context->active_tcase, context->active_test);
-
- if (reason)
- printf(" [\n%s\n]", reason);
- printf("\n");
+ talloc_free(fullname);
}
-static void subunit_comment(struct torture_context *test,
+static void torture_subunit_comment(struct torture_context *test,
const char *comment)
{
fprintf(stderr, "%s", comment);
}
-static void subunit_warning(struct torture_context *test,
+static void torture_subunit_warning(struct torture_context *test,
const char *comment)
{
fprintf(stderr, "WARNING!: %s\n", comment);
}
-static void subunit_progress(struct torture_context *tctx, int offset, enum torture_progress_whence whence)
+static void torture_subunit_progress(struct torture_context *tctx, int offset, enum torture_progress_whence whence)
{
switch (whence) {
case TORTURE_PROGRESS_SET:
@@ -103,10 +101,10 @@ static void subunit_progress(struct torture_context *tctx, int offset, enum tort
}
const struct torture_ui_ops torture_subunit_ui_ops = {
- .comment = subunit_comment,
- .warning = subunit_warning,
- .test_start = subunit_test_start,
- .test_result = subunit_test_result,
- .suite_start = subunit_suite_start,
- .progress = subunit_progress,
+ .comment = torture_subunit_comment,
+ .warning = torture_subunit_warning,
+ .test_start = torture_subunit_test_start,
+ .test_result = torture_subunit_test_result,
+ .suite_start = torture_subunit_suite_start,
+ .progress = torture_subunit_progress,
};
diff --git a/lib/torture/wscript_build b/lib/torture/wscript_build
index 6866624e13..56f17a636d 100644
--- a/lib/torture/wscript_build
+++ b/lib/torture/wscript_build
@@ -2,7 +2,8 @@
bld.SAMBA_LIBRARY('torture',
- source='torture.c subunit.c',
+ source='torture.c subunit.c ../subunit/c/lib/child.c',
+ includes='../subunit/c/include',
vnum='0.0.1',
pc_files='torture.pc',
public_deps='LIBSAMBA-HOSTCONFIG LIBSAMBA-UTIL LIBSAMBA-ERRORS talloc tevent',