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

Unified Diff: base/process_util_unittest.cc

Issue 13529020: MacTerminateOnHeapCorruption shouldn't leak the OOM killer into the shared test context. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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_util_unittest.cc
diff --git a/base/process_util_unittest.cc b/base/process_util_unittest.cc
index ef383b6175a04614e4572599fb3b61d304c87e7b..1080de76b724ed9713606538dff6c0b1cfec0925 100644
--- a/base/process_util_unittest.cc
+++ b/base/process_util_unittest.cc
@@ -543,17 +543,17 @@ TEST_F(ProcessUtilTest, LaunchAsUser) {
// The following code tests the system implementation of malloc() thus no need
// to test it under AddressSanitizer.
TEST_F(ProcessUtilTest, MacMallocFailureDoesNotTerminate) {
- // Install the OOM killer.
- base::EnableTerminationOnOutOfMemory();
-
// 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
// does not call through malloc_error_break(). See the comment at
// EnableTerminationOnOutOfMemory() for more information.
void* buf = NULL;
- ASSERT_EXIT(
- buf = malloc(std::numeric_limits<size_t>::max() - (2 * PAGE_SIZE) - 1),
+ ASSERT_EXIT({
+ // Install the OOM killer.
+ base::EnableTerminationOnOutOfMemory();
+
+ buf = malloc(std::numeric_limits<size_t>::max() - (2 * PAGE_SIZE) - 1);},
Robert Sesek 2013/04/05 18:13:22 nit: I'd balance the } on a new line indented 4 sp
testing::KilledBySignal(SIGTRAP),
"\\*\\*\\* error: can't allocate region.*"
"(Terminating process due to a potential for future heap "
« 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