summaryrefslogtreecommitdiff
path: root/source4/torture/ui.c
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2006-06-12 23:03:02 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:09:05 -0500
commit02aee3000d9fb29997d275e62a730ef97aca0128 (patch)
tree021a676444245af0a5705ab4db3c19400190c5d5 /source4/torture/ui.c
parent90be000cd5d02e480bba8d68a56e5b8a2f8711ab (diff)
downloadsamba-02aee3000d9fb29997d275e62a730ef97aca0128.tar.gz
samba-02aee3000d9fb29997d275e62a730ef97aca0128.tar.bz2
samba-02aee3000d9fb29997d275e62a730ef97aca0128.zip
r16174: Couple of fixes to the UI code - make 'torture_ok()' optional, be more verbose by default.
(This used to be commit 8ef13a50b9e80811342058cdf15cf84a8ed7532e)
Diffstat (limited to 'source4/torture/ui.c')
-rw-r--r--source4/torture/ui.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/source4/torture/ui.c b/source4/torture/ui.c
index 9c25991d20..62f8bacb65 100644
--- a/source4/torture/ui.c
+++ b/source4/torture/ui.c
@@ -22,6 +22,17 @@
#include "includes.h"
#include "torture/ui.h"
+static int test_destructor(void *_test)
+{
+ struct torture_test *test = _test;
+
+ if (test->result == TORTURE_OK)
+ torture_ok(test);
+
+ return 0;
+}
+
+
struct torture_test *torture_test(struct torture_context *ctx, const char *name, const char *description)
{
struct torture_test *test = talloc(ctx, struct torture_test);
@@ -32,6 +43,8 @@ struct torture_test *torture_test(struct torture_context *ctx, const char *name,
ctx->ui_ops->test_start(test);
+ talloc_set_destructor(test, test_destructor);
+
return test;
}
@@ -44,8 +57,10 @@ struct torture_test *torture_subtest(struct torture_test *parent, const char *na
test->context = parent->context;
test->context->ui_ops->test_start(test);
+
+ talloc_set_destructor(test, test_destructor);
- return NULL;
+ return test;
}
void torture_comment(struct torture_test *test, const char *comment, ...) _PRINTF_ATTRIBUTE(2,3)
@@ -60,6 +75,7 @@ void torture_comment(struct torture_test *test, const char *comment, ...) _PRINT
talloc_free(tmp);
}
+
void torture_ok(struct torture_test *test)
{
test->context->ui_ops->test_result(test, TORTURE_OK, NULL);