summaryrefslogtreecommitdiff
path: root/libc/malloc_debug/tests
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2019-04-09 16:37:23 -0700
committerChristopher Ferris <cferris@google.com>2019-04-16 11:22:06 -0700
commit8189e77bbb47dbaa1a09d565c62c2fed03e358c3 (patch)
tree2c8fc5d8fd1ec1ab881d35519670104ad86283e3 /libc/malloc_debug/tests
parentb9a7c651f178323e27752406f89d741cfb143e61 (diff)
Remove gMallocLeakZygoteChild.
Remove this global variable and change the setting of it to non-zero to a call to android_mallopt. In addition, change the initialize function to use pass a bool* instead of int*. Bug: 130028357 Test: Ran malloc_debug/malloc_hooks/perfetto tests. Change-Id: I20d382bdeaaf38aac6b9dcabea5b3dfab3c945f6 Merged-In: I20d382bdeaaf38aac6b9dcabea5b3dfab3c945f6 (cherry picked from commit 5225b342f0810c027df3d09fbbcef4d324b19b93)
Diffstat (limited to 'libc/malloc_debug/tests')
-rw-r--r--libc/malloc_debug/tests/malloc_debug_unit_tests.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/libc/malloc_debug/tests/malloc_debug_unit_tests.cpp b/libc/malloc_debug/tests/malloc_debug_unit_tests.cpp
index f611f3da7..0238d1049 100644
--- a/libc/malloc_debug/tests/malloc_debug_unit_tests.cpp
+++ b/libc/malloc_debug/tests/malloc_debug_unit_tests.cpp
@@ -50,7 +50,7 @@
__BEGIN_DECLS
-bool debug_initialize(const MallocDispatch*, int*, const char*);
+bool debug_initialize(const MallocDispatch*, bool*, const char*);
void debug_finalize();
void* debug_malloc(size_t);
@@ -103,8 +103,8 @@ class MallocDebugTest : public ::testing::Test {
}
void Init(const char* options) {
- zygote = 0;
- ASSERT_TRUE(debug_initialize(&dispatch, &zygote, options));
+ zygote_child = false;
+ ASSERT_TRUE(debug_initialize(&dispatch, &zygote_child, options));
initialized = true;
}
@@ -116,7 +116,7 @@ class MallocDebugTest : public ::testing::Test {
bool initialized;
- int zygote;
+ bool zygote_child;
static MallocDispatch dispatch;
};
@@ -1344,7 +1344,7 @@ void MallocDebugTest::BacktraceDumpOnSignal(bool trigger_with_alloc) {
backtrace_fake_add(std::vector<uintptr_t> {0xa300, 0xb300});
std::vector<void*> pointers;
- zygote = 1;
+ zygote_child = true;
pointers.push_back(debug_malloc(100));
ASSERT_TRUE(pointers.back() != nullptr);
pointers.push_back(debug_malloc(40));
@@ -1352,7 +1352,7 @@ void MallocDebugTest::BacktraceDumpOnSignal(bool trigger_with_alloc) {
pointers.push_back(debug_malloc(200));
ASSERT_TRUE(pointers.back() != nullptr);
- zygote = 0;
+ zygote_child = false;
pointers.push_back(debug_malloc(10));
ASSERT_TRUE(pointers.back() != nullptr);
pointers.push_back(debug_malloc(50));
@@ -1750,7 +1750,7 @@ TEST_F(MallocDebugTest, backtrace_same_stack_zygote) {
backtrace_fake_add(std::vector<uintptr_t> {0xbc000, 0xecd00, 0x12000});
backtrace_fake_add(std::vector<uintptr_t> {0xbc000});
- zygote = 1;
+ zygote_child = true;
void* pointers[4];
pointers[0] = debug_malloc(100);
@@ -1809,14 +1809,14 @@ TEST_F(MallocDebugTest, backtrace_same_stack_mix_zygote) {
backtrace_fake_add(std::vector<uintptr_t> {0xbc000, 0xecd00, 0x12000});
backtrace_fake_add(std::vector<uintptr_t> {0xbc000});
- zygote = 1;
+ zygote_child = true;
void* pointers[4];
pointers[0] = debug_malloc(40);
ASSERT_TRUE(pointers[0] != nullptr);
pointers[1] = debug_malloc(40);
ASSERT_TRUE(pointers[1] != nullptr);
- zygote = 0;
+ zygote_child = false;
pointers[2] = debug_malloc(40);
ASSERT_TRUE(pointers[2] != nullptr);
pointers[3] = debug_malloc(100);
@@ -1989,7 +1989,7 @@ TEST_F(MallocDebugTest, zygote_set) {
// Set all of the options.
Init("guard fill backtrace leak_track free_track=2");
- zygote = 1;
+ zygote_child = true;
backtrace_fake_add(std::vector<uintptr_t> {0x1});