svn commit: samba r6563 - in branches/SAMBA_4_0/source/torture/local: .

tridge at samba.org tridge at samba.org
Sun May 1 18:51:16 GMT 2005


Author: tridge
Date: 2005-05-01 18:51:16 +0000 (Sun, 01 May 2005)
New Revision: 6563

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=6563

Log:
- 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

Modified:
   branches/SAMBA_4_0/source/torture/local/messaging.c


Changeset:
Modified: branches/SAMBA_4_0/source/torture/local/messaging.c
===================================================================
--- branches/SAMBA_4_0/source/torture/local/messaging.c	2005-05-01 18:49:43 UTC (rev 6562)
+++ branches/SAMBA_4_0/source/torture/local/messaging.c	2005-05-01 18:51:16 UTC (rev 6563)
@@ -55,28 +55,27 @@
 */
 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);
-		}
+	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);
-	}
+	messaging_register(msg_ctx2, NULL, MY_PING, ping_message);
+	messaging_register(msg_ctx2, mem_ctx, MY_EXIT, exit_message);
 
-	sleep(2);
-
 	msg_ctx = messaging_init(mem_ctx, 2, ev);
 
 	if (!msg_ctx) {
@@ -124,7 +123,8 @@
 	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 @@
 	talloc_free(msg_ctx);
 
 	talloc_free(ev);
+
 	return ret;
 }
 



More information about the samba-cvs mailing list