Fix arena_test test break using glibc-2.17

Summary: arena_test is failing with glibc-2.17. Make it more robust

Test Plan: Run arena_test using both of glibc-2.17 and 2.2 and make sure both passes.

Reviewers: yhchiang, rven, IslamAbdelRahman, kradhakrishnan, igor

Reviewed By: igor

Subscribers: leveldb, dhruba

Differential Revision: https://reviews.facebook.net/D45879
main
sdong 9 years ago
parent 77a28615ec
commit 9d6503f88d
  1. 14
      util/arena_test.cc

@ -58,21 +58,15 @@ void MemoryAllocatedBytesTest(size_t huge_page_size) {
ASSERT_EQ(arena.MemoryAllocatedBytes(), expected_memory_allocated); ASSERT_EQ(arena.MemoryAllocatedBytes(), expected_memory_allocated);
} }
// requested size > quarter of a block: // requested size > size of a block:
// allocate requested size separately // allocate requested size separately
req_sz = 999 * 4096; expected_memory_allocated = arena.MemoryAllocatedBytes();
req_sz = 8 * 1024 * 1024;
for (int i = 0; i < N; i++) { for (int i = 0; i < N; i++) {
arena.Allocate(req_sz); arena.Allocate(req_sz);
} }
expected_memory_allocated += req_sz * N; expected_memory_allocated += req_sz * N;
if (huge_page_size) { ASSERT_EQ(arena.MemoryAllocatedBytes(), expected_memory_allocated);
ASSERT_TRUE(arena.MemoryAllocatedBytes() ==
expected_memory_allocated + bsz ||
arena.MemoryAllocatedBytes() ==
expected_memory_allocated + huge_page_size);
} else {
ASSERT_EQ(arena.MemoryAllocatedBytes(), expected_memory_allocated);
}
} }
// Make sure we didn't count the allocate but not used memory space in // Make sure we didn't count the allocate but not used memory space in

Loading…
Cancel
Save