summaryrefslogtreecommitdiff
path: root/tests/malloc_iterate_test.cpp
diff options
context:
space:
mode:
authorSandeep Patil <sspatil@google.com>2019-01-30 17:45:48 -0800
committerSandeep Patil <sspatil@google.com>2019-02-10 17:27:39 -0800
commit7d2aea09ddced6e8a1435e862470a5f5cc9f1757 (patch)
treeba5fa43b6207b5d435d75e1f0ba5f2e085aa35b2 /tests/malloc_iterate_test.cpp
parent1d3c56bc308c34217e36def4b408d8bae390924e (diff)
bionic/malloc_iterate_test: Adjust callback for procinfo::ReadMapFile
Bug: 123532375 Test: Builds Change-Id: I8e782d9050b4d6a0726e8c880d4064df99c763e5 Signed-off-by: Sandeep Patil <sspatil@google.com>
Diffstat (limited to 'tests/malloc_iterate_test.cpp')
-rw-r--r--tests/malloc_iterate_test.cpp34
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