From a071f48b1f2088c4dd1a18dac58834e4488ac563 Mon Sep 17 00:00:00 2001 From: Christopher Ferris Date: Mon, 22 Feb 2016 19:14:26 -0800 Subject: [PATCH] Fix wrong guard values for 64 bit. I added the code to force alignments of 8 for 32 bit and 16 for 64 bit, but I missed a couple of tests that failed due to this change. Fix the failing tests. Bug: 26739265 (cherry picked from commit 0e2a0265798ed47cbbf6977f0f84cf81d93173a6) Change-Id: I21c3e26a340df6e427f06625e525b88b19b0cae1 --- libc/malloc_debug/tests/malloc_debug_config_tests.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/libc/malloc_debug/tests/malloc_debug_config_tests.cpp b/libc/malloc_debug/tests/malloc_debug_config_tests.cpp index 1c800db4c..b8535e180 100644 --- a/libc/malloc_debug/tests/malloc_debug_config_tests.cpp +++ b/libc/malloc_debug/tests/malloc_debug_config_tests.cpp @@ -208,19 +208,19 @@ TEST_F(MallocDebugConfigTest, extra_space) { } TEST_F(MallocDebugConfigTest, multiple_options) { - ASSERT_TRUE(InitConfig(" backtrace=64 front_guard=24")); + ASSERT_TRUE(InitConfig(" backtrace=64 front_guard=48")); ASSERT_EQ(BACKTRACE | TRACK_ALLOCS | FRONT_GUARD, config->options); ASSERT_EQ(64U, config->backtrace_frames); - ASSERT_EQ(24U, config->front_guard_bytes); + ASSERT_EQ(48U, config->front_guard_bytes); ASSERT_STREQ("", getFakeLogBuf().c_str()); ASSERT_STREQ("", getFakeLogPrint().c_str()); } TEST_F(MallocDebugConfigTest, front_guard) { - ASSERT_TRUE(InitConfig("front_guard=24")); + ASSERT_TRUE(InitConfig("front_guard=48")); ASSERT_EQ(FRONT_GUARD, config->options); - ASSERT_EQ(24U, config->front_guard_bytes); + ASSERT_EQ(48U, config->front_guard_bytes); ASSERT_TRUE(InitConfig("front_guard")); ASSERT_EQ(FRONT_GUARD, config->options); @@ -228,7 +228,11 @@ TEST_F(MallocDebugConfigTest, front_guard) { ASSERT_TRUE(InitConfig("front_guard=39")); ASSERT_EQ(FRONT_GUARD, config->options); +#if defined(__LP64__) + ASSERT_EQ(48U, config->front_guard_bytes); +#else ASSERT_EQ(40U, config->front_guard_bytes); +#endif ASSERT_TRUE(InitConfig("front_guard=41")); ASSERT_EQ(FRONT_GUARD, config->options); -- 2.11.0