summaryrefslogtreecommitdiff
path: root/source4/torture/local/event.c
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2006-06-16 22:06:09 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:09:09 -0500
commit582d46ec42144bddccddacadd52a0256f58cb453 (patch)
tree0545454b21f1ef986117f7c2e72fe957d2b662e2 /source4/torture/local/event.c
parentcc9d70bbba4e326ba89dec8cdc58b64b89f33091 (diff)
downloadsamba-582d46ec42144bddccddacadd52a0256f58cb453.tar.gz
samba-582d46ec42144bddccddacadd52a0256f58cb453.tar.bz2
samba-582d46ec42144bddccddacadd52a0256f58cb453.zip
r16304: Improve testing UI API. This now allows registering the full
test suite tree, looks a bit more like other unit testing API's, fixes some memory responsibility issues, introduces testcases, and removes the need for tests to call torture_ok(). (This used to be commit 0445b1a56a02552f895f400960b9ced39244a144)
Diffstat (limited to 'source4/torture/local/event.c')
-rw-r--r--source4/torture/local/event.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/source4/torture/local/event.c b/source4/torture/local/event.c
index 79f5413595..d886519220 100644
--- a/source4/torture/local/event.c
+++ b/source4/torture/local/event.c
@@ -34,7 +34,7 @@ static int write_fd, read_fd;
static struct fd_event *fde;
static int te_count;
static int fde_count;
-static struct torture_test *test;
+static struct torture_context *test;
static void fde_handler(struct event_context *ev_ctx, struct fd_event *f,
uint16_t flags, void *private)
@@ -75,11 +75,17 @@ static void timed_handler(struct event_context *ev_ctx, struct timed_event *te,
event_add_timed(ev_ctx, ev_ctx, timeval_current_ofs(0,500), timed_handler, private);
}
-static BOOL test_event_context(struct torture_context *torture, struct event_context *ev_ctx, const char *comment)
+static BOOL test_event_context(struct torture_context *torture, const void *_data)
{
+ struct event_context *ev_ctx;
int fd[2] = { -1, -1 };
+ BOOL try_epoll = (BOOL)_data;
+
+ ev_ctx = event_context_init_ops(torture,
+ event_standard_get_ops(),
+ &try_epoll);
- test = torture_test(torture, comment, comment);
+ test = torture;
/* reset globals */
write_fd = -1;
@@ -101,30 +107,24 @@ static BOOL test_event_context(struct torture_context *torture, struct event_con
close(read_fd);
close(write_fd);
+
+ talloc_free(ev_ctx);
- torture_ok(test);
- talloc_free(test);
return True;
}
BOOL torture_local_event(struct torture_context *torture)
{
- struct event_context *ev_ctx;
- BOOL try_epoll;
BOOL retv = True;
+ struct torture_suite *suite = torture_suite_create(torture, "LOCAL-EVENT");
- try_epoll = False;
- ev_ctx = event_context_init_ops(torture, event_standard_get_ops(),
- &try_epoll);
- retv &= test_event_context(torture, ev_ctx, "standard with select");
- talloc_free(ev_ctx);
+ torture_suite_add_simple_tcase(suite, "standard with select",
+ test_event_context,
+ (void *)False);
- try_epoll = True;
- ev_ctx = event_context_init_ops(torture, event_standard_get_ops(),
- &try_epoll);
- retv &= test_event_context(torture, ev_ctx,
- "standard try epool (or select)");
- talloc_free(ev_ctx);
+ torture_suite_add_simple_tcase(suite, "standard try epoll (or select)",
+ test_event_context,
+ (void *)True);
return retv;
}