# HG changeset patch # User Maxim Dounin # Date 1251477915 -14400 # Node ID 2ce9d8a1ca9312a955f4f4db4ea567aca8460b4c # Parent 2054159546d076aa7ad2ef2efa91410d344543d9 Keepalive: fix tests for memcached 1.2.7+. UDP ports are on by default in 1.2.7+, so we have to explicitly switch them off to avoid conflicts when running two memcached servers. Do it conditionally for now to keep compatibility with old memcached servers without UDP support. Not sure it's really needed since UDP support is here since memcached 1.2.1, probably should be done unconditionally instead. diff --git a/t/memcached-keepalive.t b/t/memcached-keepalive.t --- a/t/memcached-keepalive.t +++ b/t/memcached-keepalive.t @@ -94,20 +94,27 @@ http { EOF -if (`memcached -h` =~ /repcached/) { +my $memhelp = `memcached -h`; +my @memopts1 = (); +my @memopts2 = (); + +if ($memhelp =~ /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'); + push @memopts1, '-X', '8091'; + push @memopts2, '-X', '8092'; +} +if ($memhelp =~ /-U/) { + # UDP ports no longer off by default in memcached 1.2.7+ -} else { - $t->run_daemon('memcached', '-l', '127.0.0.1', '-p', '8081'); - $t->run_daemon('memcached', '-l', '127.0.0.1', '-p', '8082'); + push @memopts1, '-U', '0'; + push @memopts2, '-U', '0'; } +$t->run_daemon('memcached', '-l', '127.0.0.1', '-p', '8081', @memopts1); +$t->run_daemon('memcached', '-l', '127.0.0.1', '-p', '8082', @memopts2); + $t->run(); $t->waitforsocket('127.0.0.1:8081')