From 0e5de220d988c51e9bc322dadfafd6d1ba0fa131 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 1 May 2005 18:51:16 +0000 Subject: r6563: - fixed the local messaging torture test not to fork, as this causes trouble with the epoll() based event handling - changes the test to use a local directory instead of the prefix lock directory, so the LOCAL-MESSAGING test can run as non-root even when the lock directory is not writeable (This used to be commit 079e1f4e85832f8d14ac385511ff67473e139ca1) --- source4/torture/local/messaging.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'source4/torture/local/messaging.c') diff --git a/source4/torture/local/messaging.c b/source4/torture/local/messaging.c index f12f3f6bdf..75e51fb534 100644 --- a/source4/torture/local/messaging.c +++ b/source4/torture/local/messaging.c @@ -55,27 +55,26 @@ static void exit_message(struct messaging_context *msg, void *private, */ static BOOL test_ping_speed(TALLOC_CTX *mem_ctx) { - struct event_context *ev = event_context_init(mem_ctx); + struct event_context *ev; struct messaging_context *msg_ctx; + struct messaging_context *msg_ctx2; int ping_count = 0; int pong_count = 0; BOOL ret = True; struct timeval tv; - if (fork() == 0) { - struct messaging_context *msg_ctx2 = messaging_init(mem_ctx, 1, ev); + lp_set_cmdline("lock dir", "lockdir.tmp"); + + ev = event_context_init(mem_ctx); + + msg_ctx2 = messaging_init(mem_ctx, 1, ev); - if (!msg_ctx2) { - exit(1); - } - - messaging_register(msg_ctx2, NULL, MY_PING, ping_message); - messaging_register(msg_ctx2, mem_ctx, MY_EXIT, exit_message); - event_loop_wait(ev); - exit(0); + if (!msg_ctx2) { + exit(1); } - - sleep(2); + + messaging_register(msg_ctx2, NULL, MY_PING, ping_message); + messaging_register(msg_ctx2, mem_ctx, MY_EXIT, exit_message); msg_ctx = messaging_init(mem_ctx, 2, ev); @@ -124,7 +123,8 @@ static BOOL test_ping_speed(TALLOC_CTX *mem_ctx) messaging_send(msg_ctx, 1, MY_EXIT, NULL); if (ping_count != pong_count) { - printf("ping test failed! received %d, sent %d\n", pong_count, ping_count); + printf("ping test failed! received %d, sent %d\n", + pong_count, ping_count); ret = False; } @@ -134,6 +134,7 @@ static BOOL test_ping_speed(TALLOC_CTX *mem_ctx) talloc_free(msg_ctx); talloc_free(ev); + return ret; } -- cgit