[memcached] bradfitz,
r352: start of work on 64-bit hosts. at least...
commits at code.sixapart.com
commits at code.sixapart.com
Mon Sep 4 10:41:36 UTC 2006
start of work on 64-bit hosts. at least identifying 32-bit builds
U trunk/server/slabs.c
U trunk/server/test/64bit.t
Modified: trunk/server/slabs.c
===================================================================
--- trunk/server/slabs.c 2006-09-04 07:41:00 UTC (rev 351)
+++ trunk/server/slabs.c 2006-09-04 10:41:36 UTC (rev 352)
@@ -106,8 +106,22 @@
slabclass[power_largest].size = POWER_BLOCK;
slabclass[power_largest].perslab = 1;
+ /* for the test suite: faking of how much we've already malloc'd */
+ {
+ char *t_initial_malloc = getenv("T_MEMD_INITIAL_MALLOC");
+ if (t_initial_malloc) {
+ mem_malloced = atoll(getenv("T_MEMD_INITIAL_MALLOC"));
+ }
+
+ }
+
#ifndef DONT_PREALLOC_SLABS
- slabs_preallocate(limit / POWER_BLOCK);
+ {
+ char *pre_alloc = getenv("T_MEMD_SLABS_ALLOC");
+ if (!pre_alloc || atoi(pre_alloc)) {
+ slabs_preallocate(limit / POWER_BLOCK);
+ }
+ }
#endif
}
Modified: trunk/server/test/64bit.t
===================================================================
--- trunk/server/test/64bit.t 2006-09-04 07:41:00 UTC (rev 351)
+++ trunk/server/test/64bit.t 2006-09-04 10:41:36 UTC (rev 352)
@@ -1,11 +1,30 @@
#!/usr/bin/perl
use strict;
-use Test::More skip_all => "Tests not written."; # tests => 1
+use Test::More;
use FindBin qw($Bin);
use lib "$Bin/lib";
use MemcachedTest;
+$ENV{T_MEMD_INITIAL_MALLOC} = 4294967328; # 2**32 + 32 :)
+$ENV{T_MEMD_SLABS_ALLOC} = 0; # don't preallocate slabs
+
my $server = new_memcached();
my $sock = $server->sock;
+{
+ print $sock "stats slabs\r\n";
+ my %stats;
+ while (<$sock>) {
+ last if /^(\.|END)/;
+ /^STAT (\S+) (\d+)/;
+ $stats{$1} = $2;
+ }
+ if ($stats{'total_malloced'} eq "32") {
+ plan skip_all => 'Skipping 64-bit tests on 32-bit build';
+ exit 0;
+ } else {
+ plan tests => 1;
+ }
+ ok(1, "is 64 bit");
+}
More information about the memcached-commits
mailing list