diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-05-01 18:51:16 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:16:26 -0500 |
commit | 0e5de220d988c51e9bc322dadfafd6d1ba0fa131 (patch) | |
tree | 4c00fa1ed6701f6bd56d984394ba15b7922fe0ff | |
parent | b2584a403c6382ef478755979d955043fc9569a1 (diff) | |
download | samba-0e5de220d988c51e9bc322dadfafd6d1ba0fa131.tar.gz samba-0e5de220d988c51e9bc322dadfafd6d1ba0fa131.tar.bz2 samba-0e5de220d988c51e9bc322dadfafd6d1ba0fa131.zip |
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)
-rw-r--r-- | source4/torture/local/messaging.c | 29 |
1 files changed, 15 insertions, 14 deletions
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; } |