"Fossies" - the Fresh Open Source Software Archive

Member "memcached-1.6.15/t/issue_41.t" (16 Jul 2020, 980 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 warnings;
    5 use POSIX qw(ceil);
    6 use Test::More tests => 691;
    7 use FindBin qw($Bin);
    8 use lib "$Bin/lib";
    9 use MemcachedTest;
   10 
   11 my $server = new_memcached();
   12 my $sock = $server->sock;
   13 
   14 my $factor = 2;
   15 my $val = "x" x $factor;
   16 my $key = '';
   17 
   18 # SET items of diverse size to the daemon so it can attempt
   19 # to return a large stats output for slabs
   20 for (my $i=0; $i<69; $i++) {
   21     for (my $j=0; $j<10; $j++) {
   22         $key = "$i:$j";
   23         print $sock "set key$key 0 0 $factor\r\n$val\r\n";
   24         is (scalar <$sock>, "STORED\r\n", "stored key$key");
   25     }
   26     $factor *= 1.2;
   27     $factor = ceil($factor);
   28     $val = "x" x $factor;
   29 }
   30 
   31 # This request will kill the daemon if it has not allocated
   32 # enough memory internally.
   33 my $stats = mem_stats($sock, "slabs");
   34 
   35 # Verify whether the daemon is still running or not by asking
   36 # it for statistics.
   37 print $sock "version\r\n";
   38 my $v = scalar <$sock>;
   39 ok(defined $v && length($v), "memcached didn't respond");