Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

executable file 33 lines (24 sloc) 0.738 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
#!/usr/bin/perl

use strict;
use Test::More tests => 7;
use FindBin qw($Bin);
use lib "$Bin/lib";
use MemcachedTest;

use File::Temp qw(tempfile);

my (undef, $tmpfn) = tempfile();

my $server = new_memcached("-d -P $tmpfn");
my $sock = $server->sock;
sleep 0.5;

ok(-e $tmpfn, "pid file exists");
ok(-s $tmpfn, "pid file has length");

open (my $fh, $tmpfn) or die;
my $readpid = do { local $/; <$fh>; };
chomp $readpid;
close ($fh);

ok(kill(0, $readpid), "process is still running");

my $stats = mem_stats($sock);
is($stats->{pid}, $readpid, "memcached reports same pid as file");

ok($server->new_sock, "opened new socket");
ok(kill(9, $readpid), "sent KILL signal");
sleep 0.5;
ok(! $server->new_sock, "failed to open new socket");
Something went wrong with that request. Please try again.