From 9d6503f88dcc50800d071ce3ec970a258c87a7b9 Mon Sep 17 00:00:00 2001 From: sdong Date: Mon, 31 Aug 2015 16:20:40 -0700 Subject: [PATCH] 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 --- util/arena_test.cc | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/util/arena_test.cc b/util/arena_test.cc index 6f11643e1..a5336eb8b 100644 --- a/util/arena_test.cc +++ b/util/arena_test.cc @@ -58,21 +58,15 @@ void MemoryAllocatedBytesTest(size_t huge_page_size) { ASSERT_EQ(arena.MemoryAllocatedBytes(), expected_memory_allocated); } - // requested size > quarter of a block: + // requested size > size of a block: // 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++) { arena.Allocate(req_sz); } expected_memory_allocated += req_sz * N; - if (huge_page_size) { - ASSERT_TRUE(arena.MemoryAllocatedBytes() == - expected_memory_allocated + bsz || - arena.MemoryAllocatedBytes() == - expected_memory_allocated + huge_page_size); - } else { - ASSERT_EQ(arena.MemoryAllocatedBytes(), expected_memory_allocated); - } + ASSERT_EQ(arena.MemoryAllocatedBytes(), expected_memory_allocated); } // Make sure we didn't count the allocate but not used memory space in -- GitLab