diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/torture/subunit.c | 52 | ||||
-rw-r--r-- | lib/torture/wscript_build | 3 |
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', |