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

Unified Diff: base/process_util_unittest.cc

Issue 9622023: Revert 125441 - In CrMallocErrorBreak, do not kill the process if errno is ENOMEM. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 9 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 | « base/process_util_mac.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process_util_unittest.cc
===================================================================
--- base/process_util_unittest.cc (revision 125463)
+++ base/process_util_unittest.cc (working copy)
@@ -7,7 +7,6 @@
#include <limits>
#include "base/command_line.h"
-#include "base/debug/alias.h"
#include "base/eintr_wrapper.h"
#include "base/file_path.h"
#include "base/logging.h"
@@ -23,12 +22,12 @@
#include "testing/multiprocess_func_list.h"
#if defined(OS_LINUX)
+#include <errno.h>
#include <malloc.h>
#include <glib.h>
#include <sched.h>
#endif
#if defined(OS_POSIX)
-#include <errno.h>
#include <dlfcn.h>
#include <fcntl.h>
#include <signal.h>
@@ -40,7 +39,6 @@
#include <windows.h>
#endif
#if defined(OS_MACOSX)
-#include <mach/vm_param.h>
#include <malloc/malloc.h>
#include "base/process_util_unittest_mac.h"
#endif
@@ -451,27 +449,11 @@
#if defined(OS_MACOSX)
-// For the following Mac tests:
-// Note that base::EnableTerminationOnHeapCorruption() is called as part of
-// test suite setup and does not need to be done again, else mach_override
-// will fail.
-
-TEST_F(ProcessUtilTest, MacMallocFailureDoesNotTerminate) {
- // Test that ENOMEM doesn't crash. The number of bytes is one less than
- // MALLOC_ABSOLUTE_MAX_SIZE, above which the system early-returns NULL and
- // does not call through malloc_error_break(). See the comment at
- // EnableTerminationOnOutOfMemory() for more information.
- void* buf = malloc(std::numeric_limits<size_t>::max() - (2 * PAGE_SIZE) - 1);
-
- // The optimizer can be too efficient in Release mode, so alias the value.
- base::debug::Alias(buf);
-
- EXPECT_FALSE(buf);
- EXPECT_EQ(ENOMEM, errno);
-}
-
TEST_F(ProcessUtilTest, MacTerminateOnHeapCorruption) {
- // Assert that freeing an unallocated pointer will crash the process.
+ // Note that base::EnableTerminationOnHeapCorruption() is called as part of
+ // test suite setup and does not need to be done again, else mach_override
+ // will fail.
+
char buf[3];
#ifndef ADDRESS_SANITIZER
ASSERT_DEATH(free(buf), "being freed.*"
« no previous file with comments | « base/process_util_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698