summaryrefslogtreecommitdiff
path: root/t/lib
diff options
context:
space:
mode:
authordormando <dormando@rydia.net>2020-11-20 15:40:12 -0800
committerdormando <dormando@rydia.net>2020-11-20 15:40:12 -0800
commitc472369fed5981ba8c004d426cee62d5165c47ca (patch)
treeabaa56fe8812a9d2b38d4463f7ff29ce66230c4e /t/lib
parent4821f7e8737f0265f032aa1c3318aeb871015f16 (diff)
downloadmemcached-c472369fed5981ba8c004d426cee62d5165c47ca.tar.gz
improve shutdown tests1.6.9
new tests were flaky for slow systems; for some reason writing to the closet socket would exit prove instead of throw any kind of error. Instead we check that the child pid actually exits and loop a bit to avoid the race.
Diffstat (limited to 't/lib')
-rw-r--r--t/lib/MemcachedTest.pm7
1 files changed, 7 insertions, 0 deletions
diff --git a/t/lib/MemcachedTest.pm b/t/lib/MemcachedTest.pm
index cb5bd15..b39271d 100644
--- a/t/lib/MemcachedTest.pm
+++ b/t/lib/MemcachedTest.pm
@@ -387,6 +387,7 @@ END {
############################################################################
package Memcached::Handle;
+use POSIX ":sys_wait_h";
sub new {
my ($class, %params) = @_;
return bless \%params, $class;
@@ -407,6 +408,12 @@ sub graceful_stop {
kill 'SIGUSR1', $self->{pid};
}
+# -1 if the pid is actually dead.
+sub is_running {
+ my $self = shift;
+ return waitpid($self->{pid}, WNOHANG) >= 0 ? 1 : 0;
+}
+
sub host { $_[0]{host} }
sub port { $_[0]{port} }
sub udpport { $_[0]{udpport} }