changeset 12:067ddc059ee0

Keepalive: fix tests to be compatible with repcached patches. And add waitforsocket() calls to avoid startup races.
author Maxim Dounin <mdounin@mdounin.ru>
date Wed, 19 Nov 2008 22:23:21 +0300
parents 15530a464dba
children 181a487581b7
files t/memcached-keepalive.t
diffstat 1 files changed, 19 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/t/memcached-keepalive.t	Thu Nov 13 19:36:23 2008 +0300
+++ b/t/memcached-keepalive.t	Wed Nov 19 22:23:21 2008 +0300
@@ -94,10 +94,27 @@
 
 EOF
 
-$t->run_daemon('memcached', '-l', '127.0.0.1', '-p', '8081');
-$t->run_daemon('memcached', '-l', '127.0.0.1', '-p', '8082');
+if (`memcached -h` =~ /repcached/) {
+	# repcached patches adds additional listen socket memcached
+	# that should be different too
+
+	$t->run_daemon('memcached', '-l', '127.0.0.1', '-p', '8081',
+		'-X', '8091');
+	$t->run_daemon('memcached', '-l', '127.0.0.1', '-p', '8082',
+		'-X', '8092');
+
+} else {
+	$t->run_daemon('memcached', '-l', '127.0.0.1', '-p', '8081');
+	$t->run_daemon('memcached', '-l', '127.0.0.1', '-p', '8082');
+}
+
 $t->run();
 
+$t->waitforsocket('127.0.0.1:8081')
+	or die "Unable to start memcached";
+$t->waitforsocket('127.0.0.1:8082')
+	or die "Unable to start second memcached";
+
 ###############################################################################
 
 my $memd1 = Cache::Memcached->new(servers => [ '127.0.0.1:8081' ]);