summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorshess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-31 23:57:00 +0000
committershess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-31 23:57:00 +0000
commitdbbf9ef5a5a2e4a229c66d904298e8a8165e8bf2 (patch)
tree5058bc5877ab2b1e58d00f6265abf470c49318fd /base
parent799370127cfbb5bd41fb581b98161e0f478dec62 (diff)
downloadchromium_src-dbbf9ef5a5a2e4a229c66d904298e8a8165e8bf2.zip
chromium_src-dbbf9ef5a5a2e4a229c66d904298e8a8165e8bf2.tar.gz
chromium_src-dbbf9ef5a5a2e4a229c66d904298e8a8165e8bf2.tar.bz2
Disable certain malloc-library tests for OSX 10.9 32-bit.
Chromium's code to enable malloc corruption detection, out-of-memory termination, and UncheckedMalloc/Calloc under older versions of the OSX malloc library stopped working under OSX 10.9 (Mavericks). The 64-bit malloc library handles corruption detection the way Chromium prefers by default, allowing everything to work correctly. Short-circuit the tests which cannot be fixed for the intersection of 32-bit and OSX >= 10.9. BUG=383082 Review URL: https://codereview.chromium.org/431663002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@286917 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/process/memory_unittest.cc23
1 files changed, 23 insertions, 0 deletions
diff --git a/base/process/memory_unittest.cc b/base/process/memory_unittest.cc
index 048c09d..21b5a5bf 100644
--- a/base/process/memory_unittest.cc
+++ b/base/process/memory_unittest.cc
@@ -21,6 +21,7 @@
#endif
#if defined(OS_MACOSX)
#include <malloc/malloc.h>
+#include "base/mac/mac_util.h"
#include "base/process/memory_unittest_mac.h"
#endif
#if defined(OS_LINUX)
@@ -108,6 +109,14 @@ TEST(ProcessMemoryTest, EnableLFH) {
// The following code tests the system implementation of malloc() thus no need
// to test it under AddressSanitizer.
TEST(ProcessMemoryTest, MacMallocFailureDoesNotTerminate) {
+#if ARCH_CPU_32_BITS
+ // The Mavericks malloc library changed in a way which breaks the tricks used
+ // to implement EnableTerminationOnOutOfMemory() with UncheckedMalloc() under
+ // 32-bit. Under 64-bit the oom_killer code handles this.
+ if (base::mac::IsOSMavericksOrLater())
+ return;
+#endif
+
// Test that ENOMEM doesn't crash via CrMallocErrorBreak two ways: the exit
// code and lack of the error string. The number of bytes is one less than
// MALLOC_ABSOLUTE_MAX_SIZE, more than which the system early-returns NULL and
@@ -397,6 +406,13 @@ class OutOfMemoryHandledTest : public OutOfMemoryTest {
// under sanitizer tools.
#if !defined(MEMORY_TOOL_REPLACES_ALLOCATOR)
TEST_F(OutOfMemoryHandledTest, UncheckedMalloc) {
+#if defined(OS_MACOSX) && ARCH_CPU_32_BITS
+ // The Mavericks malloc library changed in a way which breaks the tricks used
+ // to implement EnableTerminationOnOutOfMemory() with UncheckedMalloc() under
+ // 32-bit. The 64-bit malloc library works as desired without tricks.
+ if (base::mac::IsOSMavericksOrLater())
+ return;
+#endif
EXPECT_TRUE(base::UncheckedMalloc(kSafeMallocSize, &value_));
EXPECT_TRUE(value_ != NULL);
free(value_);
@@ -406,6 +422,13 @@ TEST_F(OutOfMemoryHandledTest, UncheckedMalloc) {
}
TEST_F(OutOfMemoryHandledTest, UncheckedCalloc) {
+#if defined(OS_MACOSX) && ARCH_CPU_32_BITS
+ // The Mavericks malloc library changed in a way which breaks the tricks used
+ // to implement EnableTerminationOnOutOfMemory() with UncheckedCalloc() under
+ // 32-bit. The 64-bit malloc library works as desired without tricks.
+ if (base::mac::IsOSMavericksOrLater())
+ return;
+#endif
EXPECT_TRUE(base::UncheckedCalloc(1, kSafeMallocSize, &value_));
EXPECT_TRUE(value_ != NULL);
const char* bytes = static_cast<const char*>(value_);