summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2006-06-12 19:42:58 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:09:03 -0500
commit6845e402e1c6b43ac238d03b52c4106ff72cda90 (patch)
treea85ddf13906335d75f817afe8870f27d7cf2e838 /source4
parentc714fdaa222b9d79328f651b79d76c3141c993d5 (diff)
downloadsamba-6845e402e1c6b43ac238d03b52c4106ff72cda90.tar.gz
samba-6845e402e1c6b43ac238d03b52c4106ff72cda90.tar.bz2
samba-6845e402e1c6b43ac238d03b52c4106ff72cda90.zip
r16163: Convert to UI API
(This used to be commit 067c58f0d9743b52a05dd4c7cf78a64ea16133d9)
Diffstat (limited to 'source4')
-rw-r--r--source4/torture/local/event.c38
1 files changed, 21 insertions, 17 deletions
diff --git a/source4/torture/local/event.c b/source4/torture/local/event.c
index 92fb68c73e..79f5413595 100644
--- a/source4/torture/local/event.c
+++ b/source4/torture/local/event.c
@@ -24,6 +24,7 @@
#include "lib/events/events.h"
#include "system/filesys.h"
#include "torture/torture.h"
+#include "torture/ui.h"
const struct event_ops *event_standard_get_ops(void);
const struct event_ops *event_liboop_get_ops(void);
@@ -33,20 +34,20 @@ static int write_fd, read_fd;
static struct fd_event *fde;
static int te_count;
static int fde_count;
-static BOOL ret = True;
+static struct torture_test *test;
static void fde_handler(struct event_context *ev_ctx, struct fd_event *f,
uint16_t flags, void *private)
{
int *fd = private;
- printf("event[%d] fd[%d] events[0x%08X]", fde_count, *fd, flags);
- if (flags & EVENT_FD_READ) printf(" EVENT_FD_READ");
- if (flags & EVENT_FD_WRITE) printf(" EVENT_FD_WRITE");
- printf("\n");
+ torture_comment(test, "event[%d] fd[%d] events[0x%08X]%s%s", fde_count,
+ *fd, flags,
+ (flags & EVENT_FD_READ)?" EVENT_FD_READ":"",
+ (flags & EVENT_FD_WRITE)?" EVENT_FD_WRITE":"");
if (fde_count > 5) {
- printf("got more than fde 5 events - bug!\n");
+ torture_fail(test, "got more than fde 5 events - bug!");
talloc_free(fde);
fde = NULL;
return;
@@ -59,13 +60,13 @@ static void fde_handler(struct event_context *ev_ctx, struct fd_event *f,
static void timed_handler(struct event_context *ev_ctx, struct timed_event *te,
struct timeval tval, void *private)
{
- printf("timed_handler called[%d]\n", te_count);
+ torture_comment(test, "timed_handler called[%d]", te_count);
if (te_count > 2) {
close(write_fd);
write_fd = -1;
}
if (te_count > 5) {
- printf("remove fd event!\n");
+ torture_comment(test, "remove fd event!");
talloc_free(fde);
fde = NULL;
return;
@@ -74,12 +75,11 @@ 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 event_context *ev_ctx, const char *comment)
+static BOOL test_event_context(struct torture_context *torture, struct event_context *ev_ctx, const char *comment)
{
int fd[2] = { -1, -1 };
- printf("Testing '%s'\n", comment);
+ test = torture_test(torture, comment, comment);
/* reset globals */
write_fd = -1;
@@ -87,7 +87,6 @@ static BOOL test_event_context(struct event_context *ev_ctx, const char *comment
fde = NULL;
te_count = 0;
fde_count = 0;
- ret = True;
/* create a pipe */
pipe(fd);
@@ -103,7 +102,9 @@ static BOOL test_event_context(struct event_context *ev_ctx, const char *comment
close(read_fd);
close(write_fd);
- return ret;
+ torture_ok(test);
+ talloc_free(test);
+ return True;
}
BOOL torture_local_event(struct torture_context *torture)
@@ -113,13 +114,16 @@ BOOL torture_local_event(struct torture_context *torture)
BOOL retv = True;
try_epoll = False;
- ev_ctx = event_context_init_ops(NULL, event_standard_get_ops(), &try_epoll);
- retv &= test_event_context(ev_ctx, "standard with select");
+ 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);
try_epoll = True;
- ev_ctx = event_context_init_ops(NULL, event_standard_get_ops(), &try_epoll);
- retv &= test_event_context(ev_ctx, "standard try epool (or select)");
+ 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);
return retv;