diff options
Diffstat (limited to 't/quit.t')
-rw-r--r-- | t/quit.t | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/t/quit.t b/t/quit.t new file mode 100644 index 0000000..e371e35 --- /dev/null +++ b/t/quit.t @@ -0,0 +1,29 @@ +#!/usr/bin/perl + +use strict; +use Test::More tests => 1; +use FindBin qw($Bin); +use lib "$Bin/lib"; +use MemcachedTest; + +my $server = new_memcached(); +my $sock = $server->sock; + +{ + print $sock "quit\r\n"; + + # Five seconds ought to be enough to get hung up on. + my $oldalarmt = alarm(5); + + # Verify we can't read anything. + my $bytesread = -1; + eval { + local $SIG{'ALRM'} = sub { die "timeout" }; + my $data = ""; + $bytesread = sysread($sock, $data, 24), + }; + is($bytesread, 0, "Read after quit."); + + # Restore signal stuff. + alarm($oldalarmt); +} |