"Fossies" - the Fresh Open Source Software Archive

Member "memcached-1.6.15/t/issue_14.t" (16 Jul 2020, 806 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 => 21;
    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 my $value = "B"x66560;
   12 my $key = 0;
   13 
   14 for ($key = 0; $key < 10; $key++) {
   15     print $sock "set key$key 0 2 66560\r\n$value\r\n";
   16     is (scalar <$sock>, "STORED\r\n", "stored key$key");
   17 }
   18 
   19 #print $sock "stats slabs"
   20 my $first_stats  = mem_stats($sock, "slabs");
   21 my $first_malloc = $first_stats->{total_malloced};
   22 
   23 sleep(4);
   24 
   25 for ($key = 10; $key < 20; $key++) {
   26     print $sock "set key$key 0 2 66560\r\n$value\r\n";
   27     is (scalar <$sock>, "STORED\r\n", "stored key$key");
   28 }
   29 
   30 my $second_stats  = mem_stats($sock, "slabs");
   31 my $second_malloc = $second_stats->{total_malloced};
   32 
   33 
   34 is ($second_malloc, $first_malloc, "Memory grows..")