"Fossies" - the Fresh Open Source Software Archive

Member "memcached-1.6.15/t/quit.t" (16 Jul 2020, 593 Bytes) of package /linux/www/memcached-1.6.15.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/usr/bin/perl
    2 
    3 use strict;
    4 use Test::More tests => 1;
    5 use FindBin qw($Bin);
    6 use lib "$Bin/lib";
    7 use MemcachedTest;
    8 
    9 my $server = new_memcached();
   10 my $sock = $server->sock;
   11 
   12 {
   13     print $sock "quit\r\n";
   14 
   15     # Five seconds ought to be enough to get hung up on.
   16     my $oldalarmt = alarm(5);
   17 
   18     # Verify we can't read anything.
   19     my $bytesread = -1;
   20     eval {
   21         local $SIG{'ALRM'} = sub { die "timeout" };
   22         my $data = "";
   23         $bytesread = sysread($sock, $data, 24),
   24     };
   25     is($bytesread, 0, "Read after quit.");
   26 
   27     # Restore signal stuff.
   28     alarm($oldalarmt);
   29 }