"Fossies" - the Fresh Open Source Software Archive

Member "memcached-1.6.15/t/dash-M.t" (21 Feb 2022, 840 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. See also the last Fossies "Diffs" side-by-side code changes report for "dash-M.t": 1.6.12_vs_1.6.13.

    1 #!/usr/bin/perl
    2 
    3 use strict;
    4 use Test::More;
    5 use FindBin qw($Bin);
    6 use lib "$Bin/lib";
    7 use MemcachedTest;
    8 
    9 my $server = new_memcached('-M -m 2');
   10 my $sock = $server->sock;
   11 
   12 my $value = "B" x 8192;
   13 my $vallen = length($value);
   14 
   15 my $resp = "STORED\r\n";
   16 my $key = 0;
   17 
   18 while($resp eq "STORED\r\n") {
   19     print $sock "set dash$key 0 0 $vallen\r\n$value\r\n";
   20     $key++;
   21     $resp = scalar <$sock>;
   22 }
   23 
   24 my $max_stored = $key - 1;
   25 
   26 plan tests => $max_stored + 2;
   27 
   28 print $sock "set dash$key 0 0 $vallen\r\n$value\r\n";
   29 is(scalar <$sock>, "SERVER_ERROR out of memory storing object\r\n",
   30    "failed to add another one.");
   31 
   32 my $stats = mem_stats($sock);
   33 is($stats->{"store_no_memory"}, 2,
   34     "recorded store failures due to no memory");
   35 
   36 for($key = 0; $key < $max_stored; $key++) {
   37     mem_get_is $sock, "dash$key", $value, "Failed at dash$key";
   38 }