summaryrefslogtreecommitdiff
path: root/libc/malloc_debug/tests/malloc_debug_unit_tests.cpp
diff options
context:
space:
mode:
authorTamas Berghammer <tberghammer@google.com>2016-08-26 15:54:59 +0100
committerChristopher Ferris <cferris@google.com>2016-11-17 13:13:27 -0800
commitac81fe8657119c265edcc2f05b3e5b7c5b17ae9f (patch)
tree99a6e825926829bb7c8d955cbc96ae1777691ef9 /libc/malloc_debug/tests/malloc_debug_unit_tests.cpp
parent8945d5e43a25737f3f888a90742cc918b1124a05 (diff)
Enable malloc debug using environment variables
Previously malloc debug can be enabled only using global settings accessible to the root user only. This CL adds a new option to enable it using environment variables making it possible to use it with pure native (shell) applications on production builds (from shell user) and prepares it for using it from logwrapper on production devices. Remove the old environment variable and property since they are not necessary. Test: Enable malloc debug using environment variable and verify Test: that it only affects the commands launched from the shell. Test: Enable malloc debug using the property variable and verify Test: that it affects all commands. Test: Run all unit tests in 32 bit and 64 bit. Change-Id: Iecb75a3471552f619f196ad550c5f41fcd9ce8e5
Diffstat (limited to 'libc/malloc_debug/tests/malloc_debug_unit_tests.cpp')
-rw-r--r--libc/malloc_debug/tests/malloc_debug_unit_tests.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/libc/malloc_debug/tests/malloc_debug_unit_tests.cpp b/libc/malloc_debug/tests/malloc_debug_unit_tests.cpp
index edb03f6de..1b08a39dc 100644
--- a/libc/malloc_debug/tests/malloc_debug_unit_tests.cpp
+++ b/libc/malloc_debug/tests/malloc_debug_unit_tests.cpp
@@ -44,8 +44,7 @@
__BEGIN_DECLS
-int property_set(const char*, const char*);
-bool debug_initialize(const MallocDispatch*, int*);
+bool debug_initialize(const MallocDispatch*, int*, const char*);
void debug_finalize();
void* debug_malloc(size_t);
@@ -98,10 +97,9 @@ class MallocDebugTest : public ::testing::Test {
}
}
- void Init(const char* property_value) {
- property_set("libc.debug.malloc.options", property_value);
+ void Init(const char* options) {
zygote = 0;
- ASSERT_TRUE(debug_initialize(&dispatch, &zygote));
+ ASSERT_TRUE(debug_initialize(&dispatch, &zygote, options));
initialized = true;
}