diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2006-05-22 18:59:29 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:08:27 -0500 |
commit | f76eafe7d77bb1c3bf6d93a01324d5cf4913c0b7 (patch) | |
tree | 97b92b70b9be638c175bbd9939f32300f692d764 /source4/torture/ui.c | |
parent | 20532d7c495d75e35453ce22c383fe24925e8f00 (diff) | |
download | samba-f76eafe7d77bb1c3bf6d93a01324d5cf4913c0b7.tar.gz samba-f76eafe7d77bb1c3bf6d93a01324d5cf4913c0b7.tar.xz samba-f76eafe7d77bb1c3bf6d93a01324d5cf4913c0b7.zip |
r15818: Improve UI utilities: allow format strings and add some convenience macros.
(This used to be commit f0a4547b76bdc04c4dd32fccbb1a37a040868588)
Diffstat (limited to 'source4/torture/ui.c')
-rw-r--r-- | source4/torture/ui.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/source4/torture/ui.c b/source4/torture/ui.c index 176f911845..35ff3cee7d 100644 --- a/source4/torture/ui.c +++ b/source4/torture/ui.c @@ -62,18 +62,31 @@ void torture_comment(struct torture_test *test, const char *comment, ...) _PRINT void torture_ok(struct torture_test *test) { - test->context->ui_ops->test_result(test, TORTURE_OK); + test->context->ui_ops->test_result(test, TORTURE_OK, NULL); test->context->success++; } -void torture_fail(struct torture_test *test) +void torture_fail(struct torture_test *test, const char *fmt, ...) _PRINTF_ATTRIBUTE(2,3) { - test->context->ui_ops->test_result(test, TORTURE_FAIL); + va_list ap; + char *reason; + va_start(ap, fmt); + reason = talloc_vasprintf(test, fmt, ap); + va_end(ap); + test->context->ui_ops->test_result(test, TORTURE_FAIL, reason); + talloc_free(reason); + test->context->failed++; } -void torture_skip(struct torture_test *test) +void torture_skip(struct torture_test *test, const char *fmt, ...) _PRINTF_ATTRIBUTE(2,3) { - test->context->ui_ops->test_result(test, TORTURE_SKIP); + va_list ap; + char *reason; + va_start(ap, fmt); + reason = talloc_vasprintf(test, fmt, ap); + va_end(ap); + test->context->ui_ops->test_result(test, TORTURE_SKIP, reason); + talloc_free(reason); test->context->skipped++; } |