diff options
author | Christopher Ferris <cferris@google.com> | 2019-02-08 00:36:14 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2019-02-08 00:36:14 +0000 |
commit | 2eb1fc9df0e8e90caed5145ab2f627b8d8961b97 (patch) | |
tree | 43e6733c3ff0fb9e13dae7255cf1f5f1c2325598 | |
parent | 15a345b78981a78d3d4257db6d6e6d129fca8e6e (diff) | |
parent | 4e56228637b5e82fad30ce11b231a5bfe1cf46ea (diff) |
Merge "Fix flakiness of mallinfo test."
-rw-r--r-- | tests/malloc_test.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/tests/malloc_test.cpp b/tests/malloc_test.cpp index a3fe5af33..1431cc134 100644 --- a/tests/malloc_test.cpp +++ b/tests/malloc_test.cpp @@ -588,10 +588,13 @@ TEST(malloc, mallinfo) { size_t new_allocated = mallinfo().uordblks; if (allocated != new_allocated) { size_t usable_size = malloc_usable_size(ptrs[i]); - ASSERT_GE(new_allocated, allocated + usable_size) - << "Failed at size " << size << " usable size " << usable_size; - pass = true; - break; + // Only check if the total got bigger by at least allocation size. + // Sometimes the mallinfo numbers can go backwards due to compaction + // and/or freeing of cached data. + if (new_allocated >= allocated + usable_size) { + pass = true; + break; + } } } for (void* ptr : ptrs) { |