# HG changeset patch # User Maxim Dounin # Date 1403283712 -14400 # Node ID 020c4e47ecac39fc8c1b5506fe7e1d9e385053cf # Parent 068d020a8f85adfd63f152cab504f559123e312c Tests: revert 068d020a8f85 and localize $? instead. The problem observed was due to $? being overwritten in the destructor after it has been set by exit(), specifically by waitpid() in stop_daemons(). Fix is to localize $? in the destructor to make sure it won't be accidentally changed. diff --git a/lib/Test/Nginx.pm b/lib/Test/Nginx.pm --- a/lib/Test/Nginx.pm +++ b/lib/Test/Nginx.pm @@ -51,9 +51,13 @@ sub new { sub DESTROY { my ($self) = @_; + local $?; + return if $self->{_pid} != $$; + $self->stop(); $self->stop_daemons(); + if ($ENV{TEST_NGINX_CATLOG}) { system("cat $self->{_testdir}/error.log"); } diff --git a/upstream_hash_memcached.t b/upstream_hash_memcached.t --- a/upstream_hash_memcached.t +++ b/upstream_hash_memcached.t @@ -104,11 +104,10 @@ if ($memhelp =~ /-U/) { push @memopts, '-U', '0'; } -$t->try_run('no upstream hash')->plan(4); - $t->run_daemon('memcached', '-l', '127.0.0.1', '-p', '8081', @memopts); $t->run_daemon('memcached', '-l', '127.0.0.1', '-p', '8082', @memopts); $t->run_daemon('memcached', '-l', '127.0.0.1', '-p', '8083', @memopts); +$t->try_run('no upstream hash')->plan(4); $t->waitforsocket('127.0.0.1:8081') or die "Can't start memcached"; $t->waitforsocket('127.0.0.1:8082') or die "Can't start memcached";