diff options
| author | Treehugger Robot <treehugger-gerrit@google.com> | 2019-02-15 23:03:00 +0000 |
|---|---|---|
| committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2019-02-15 23:03:00 +0000 |
| commit | cf6cec84899e8e28d06a0739c69cf0883e5a8ffb (patch) | |
| tree | b350bcf2504046254fc6fc044fbf88c6d5efe448 | |
| parent | a192c50e5aa5f7f16b0a1eceb16e2229a320e4ac (diff) | |
| parent | 7d2aea09ddced6e8a1435e862470a5f5cc9f1757 (diff) | |
Merge "bionic/malloc_iterate_test: Adjust callback for procinfo::ReadMapFile"
| -rw-r--r-- | tests/malloc_iterate_test.cpp | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/tests/malloc_iterate_test.cpp b/tests/malloc_iterate_test.cpp index 5e60a6d11..76583ebb5 100644 --- a/tests/malloc_iterate_test.cpp +++ b/tests/malloc_iterate_test.cpp @@ -92,14 +92,15 @@ static void VerifyPtrs(TestDataType* test_data) { test_data->total_allocated_bytes = 0; // Find all of the maps that are [anon:libc_malloc]. - ASSERT_TRUE(android::procinfo::ReadMapFile("/proc/self/maps", - [&](uint64_t start, uint64_t end, uint16_t, uint64_t, const char* name) { - if (std::string(name) == "[anon:libc_malloc]") { - malloc_disable(); - malloc_iterate(start, end - start, SavePointers, test_data); - malloc_enable(); - } - })); + ASSERT_TRUE(android::procinfo::ReadMapFile( + "/proc/self/maps", + [&](uint64_t start, uint64_t end, uint16_t, uint64_t, ino_t, const char* name) { + if (std::string(name) == "[anon:libc_malloc]") { + malloc_disable(); + malloc_iterate(start, end - start, SavePointers, test_data); + malloc_enable(); + } + })); for (size_t i = 0; i < test_data->allocs.size(); i++) { EXPECT_EQ(1UL, test_data->allocs[i].count) << "Failed on size " << test_data->allocs[i].size; @@ -180,14 +181,15 @@ TEST(malloc_iterate, invalid_pointers) { TestDataType test_data = {}; // Find all of the maps that are not [anon:libc_malloc]. - ASSERT_TRUE(android::procinfo::ReadMapFile("/proc/self/maps", - [&](uint64_t start, uint64_t end, uint16_t, uint64_t, const char* name) { - if (std::string(name) != "[anon:libc_malloc]") { - malloc_disable(); - malloc_iterate(start, end - start, SavePointers, &test_data); - malloc_enable(); - } - })); + ASSERT_TRUE(android::procinfo::ReadMapFile( + "/proc/self/maps", + [&](uint64_t start, uint64_t end, uint16_t, uint64_t, ino_t, const char* name) { + if (std::string(name) != "[anon:libc_malloc]") { + malloc_disable(); + malloc_iterate(start, end - start, SavePointers, &test_data); + malloc_enable(); + } + })); ASSERT_EQ(0UL, test_data.total_allocated_bytes); #else |
