Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3373)

Unified Diff: base/process/memory_unittest.cc

Issue 431663002: Disable certain malloc-library tests for OSX 10.9 32-bit. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process/memory_unittest.cc
diff --git a/base/process/memory_unittest.cc b/base/process/memory_unittest.cc
index 048c09d38c1ed63fcf647046a0197ee2d1daf00b..21b5a5bf98f86b97d1d23a5eee2d36843d1e09cc 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_);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698