"Fossies" - the Fresh Open Source Software Archive

Member "memcached-1.6.15/t/issue_22.t" (16 Jul 2020, 1142 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 => 84;
    5 use FindBin qw($Bin);
    6 use lib "$Bin/lib";
    7 use MemcachedTest;
    8 
    9 my $server = new_memcached("-m 3");
   10 my $sock = $server->sock;
   11 my $value = "B"x66560;
   12 my $key = 0;
   13 
   14 for ($key = 0; $key < 40; $key++) {
   15     print $sock "set key$key 0 0 66560\r\n$value\r\n";
   16     is (scalar <$sock>, "STORED\r\n", "stored key$key");
   17 }
   18 
   19 my $first_stats  = mem_stats($sock, "items");
   20 my $first_evicted = $first_stats->{"items:31:evicted"};
   21 # I get 1 eviction on a 32 bit binary, but 4 on a 64 binary..
   22 # Just check that I have evictions...
   23 isnt ($first_evicted, "0", "check evicted");
   24 
   25 print $sock "stats reset\r\n";
   26 is (scalar <$sock>, "RESET\r\n", "Stats reset");
   27 
   28 my $second_stats  = mem_stats($sock, "items");
   29 my $second_evicted = $second_stats->{"items:31:evicted"};
   30 is ($second_evicted, "0", "check evicted");
   31 
   32 for ($key = 40; $key < 80; $key++) {
   33     print $sock "set key$key 0 0 66560\r\n$value\r\n";
   34     is (scalar <$sock>, "STORED\r\n", "stored key$key");
   35 }
   36 
   37 my $last_stats  = mem_stats($sock, "items");
   38 my $last_evicted = $last_stats->{"items:31:evicted"};
   39 is ($last_evicted, "40", "check evicted");