"Fossies" - the Fresh Open Source Software Archive

Member "memcached-1.6.15/t/64bit.t" (13 Oct 2014, 1138 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;
    5 use FindBin qw($Bin);
    6 use lib "$Bin/lib";
    7 use MemcachedTest;
    8 
    9 $ENV{T_MEMD_INITIAL_MALLOC} = "4294967328"; # 2**32 + 32 , just over 4GB
   10 $ENV{T_MEMD_SLABS_ALLOC}    = 0;  # don't preallocate slabs
   11 
   12 my $server = new_memcached("-m 4098 -M");
   13 my $sock = $server->sock;
   14 
   15 my ($stats, $slabs) = @_;
   16 
   17 $stats = mem_stats($sock);
   18 
   19 if ($stats->{'pointer_size'} eq "32") {
   20     plan skip_all => 'Skipping 64-bit tests on 32-bit build';
   21     exit 0;
   22 } else {
   23     plan tests => 6;
   24 }
   25 
   26 is($stats->{'pointer_size'}, 64, "is 64 bit");
   27 is($stats->{'limit_maxbytes'}, "4297064448", "max bytes is 4098 MB");
   28 
   29 $slabs = mem_stats($sock, 'slabs');
   30 is($slabs->{'total_malloced'}, "4294967328", "expected (faked) value of total_malloced");
   31 is($slabs->{'active_slabs'}, 0, "no active slabs");
   32 
   33 my $hit_limit = 0;
   34 for (1..5) {
   35     my $size = 400 * 1024;
   36     my $data = "a" x $size;
   37     print $sock "set big$_ 0 0 $size\r\n$data\r\n";
   38     my $res = <$sock>;
   39     $hit_limit = 1 if $res ne "STORED\r\n";
   40 }
   41 ok($hit_limit, "hit size limit");
   42 
   43 $slabs = mem_stats($sock, 'slabs');
   44 is($slabs->{'active_slabs'}, 1, "1 active slab");