diff options
author | Aliaksey Kandratsenka <alk@tut.by> | 2014-04-01 22:29:11 -0700 |
---|---|---|
committer | Aliaksey Kandratsenka <alk@tut.by> | 2014-04-07 12:29:35 -0700 |
commit | 8b2e5ee831760a94bc407dc255a522eda242b04f (patch) | |
tree | dcbcb76c127e36eb9a8f3901cab60abc0c70e8bd | |
parent | 0399af1019240e2d9127a588ddc8e31ff4656df0 (diff) | |
download | gperftools-8b2e5ee831760a94bc407dc255a522eda242b04f.tar.gz |
issue-614: use tc_memalign in ReallocAfterMemalloc test
Because some OSes lack plain memalign. And we really need to test our
implementation which is always available via tc_malloc.
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | src/tests/debugallocation_test.cc | 8 |
2 files changed, 3 insertions, 6 deletions
diff --git a/configure.ac b/configure.ac index 129ab2a..bb81424 100644 --- a/configure.ac +++ b/configure.ac @@ -116,7 +116,6 @@ AC_CHECK_TYPES([Elf32_Versym],,, [#include <elf.h>]) # for vdso_support.h AC_CHECK_FUNCS(sbrk) # for tcmalloc to get memory AC_CHECK_FUNCS(geteuid) # for turning off services when run as root AC_CHECK_FUNCS(fork) # for the pthread_atfork setup -AC_CHECK_FUNCS(memalign) # for a test case AC_CHECK_HEADERS(features.h) # for vdso_support.h AC_CHECK_HEADERS(malloc.h) # some systems define stuff there, others not AC_CHECK_HEADERS(sys/malloc.h) # where some versions of OS X put malloc.h diff --git a/src/tests/debugallocation_test.cc b/src/tests/debugallocation_test.cc index 8e14830..d935dbb 100644 --- a/src/tests/debugallocation_test.cc +++ b/src/tests/debugallocation_test.cc @@ -33,10 +33,10 @@ #include <stdio.h> #include <stdlib.h> -#include <malloc.h> // for memalign #include <string.h> // for memcmp #include <vector> #include "gperftools/malloc_extension.h" +#include "gperftools/tcmalloc.h" #include "base/logging.h" using std::vector; @@ -298,13 +298,12 @@ TEST(DebugAllocationTest, HugeAlloc) { #endif } -#ifdef HAVE_MEMALIGN // based on test program contributed by mikesart@gmail.com aka // mikesart@valvesoftware.com. See issue-464. -TEST(DebugAllocationTest, ReallocAfterMemalloc) { +TEST(DebugAllocationTest, ReallocAfterMemalign) { char stuff[50]; memset(stuff, 0x11, sizeof(stuff)); - void *p = memalign(16, sizeof(stuff)); + void *p = tc_memalign(16, sizeof(stuff)); EXPECT_NE(p, NULL); memcpy(stuff, p, sizeof(stuff)); @@ -314,7 +313,6 @@ TEST(DebugAllocationTest, ReallocAfterMemalloc) { int rv = memcmp(stuff, p, sizeof(stuff)); EXPECT_EQ(rv, 0); } -#endif int main(int argc, char** argv) { // If you run without args, we run the non-death parts of the test. |