diff options
author | earthdok@chromium.org <earthdok@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-29 17:30:40 +0000 |
---|---|---|
committer | earthdok@chromium.org <earthdok@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-29 17:30:40 +0000 |
commit | e24b74fe09d92384df55ce53436b1d5dcb309042 (patch) | |
tree | efc1ee3b6c063f7bf592937f76bb979d0aca0482 /base/process/memory_unittest.cc | |
parent | dbe2ca2be4035c7c051db2839fb3eb23ce8926aa (diff) | |
download | chromium_src-e24b74fe09d92384df55ce53436b1d5dcb309042.zip chromium_src-e24b74fe09d92384df55ce53436b1d5dcb309042.tar.gz chromium_src-e24b74fe09d92384df55ce53436b1d5dcb309042.tar.bz2 |
Update code related to OOM errors in sanitizer builds.
Remove outdated comment and enable OOM tests under sanitizers. Also, document
the fact that the newly introduced UncheckedMalloc()/UncheckedCalloc() don't
work as intended in sanitizer builds.
BUG=357732
R=thakis@chromium.org
Review URL: https://codereview.chromium.org/217343002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@260379 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/process/memory_unittest.cc')
-rw-r--r-- | base/process/memory_unittest.cc | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/base/process/memory_unittest.cc b/base/process/memory_unittest.cc index f329fda..048c09d 100644 --- a/base/process/memory_unittest.cc +++ b/base/process/memory_unittest.cc @@ -152,13 +152,9 @@ TEST(ProcessMemoryTest, MacTerminateOnHeapCorruption) { // Android doesn't implement set_new_handler, so we can't use the // OutOfMemoryTest cases. // OpenBSD does not support these tests either. -// AddressSanitizer and ThreadSanitizer define the malloc()/free()/etc. -// functions so that they don't crash if the program is out of memory, so the -// OOM tests aren't supposed to work. // TODO(vandebo) make this work on Windows too. #if !defined(OS_ANDROID) && !defined(OS_OPENBSD) && \ - !defined(OS_WIN) && \ - !defined(ADDRESS_SANITIZER) && !defined(THREAD_SANITIZER) + !defined(OS_WIN) #if defined(USE_TCMALLOC) extern "C" { @@ -397,7 +393,9 @@ class OutOfMemoryHandledTest : public OutOfMemoryTest { // TODO(b.kelemen): make UncheckedMalloc and UncheckedCalloc work // on Windows as well. - +// UncheckedMalloc() and UncheckedCalloc() work as regular malloc()/calloc() +// under sanitizer tools. +#if !defined(MEMORY_TOOL_REPLACES_ALLOCATOR) TEST_F(OutOfMemoryHandledTest, UncheckedMalloc) { EXPECT_TRUE(base::UncheckedMalloc(kSafeMallocSize, &value_)); EXPECT_TRUE(value_ != NULL); @@ -426,6 +424,5 @@ TEST_F(OutOfMemoryHandledTest, UncheckedCalloc) { EXPECT_FALSE(base::UncheckedCalloc(1, test_size_, &value_)); EXPECT_TRUE(value_ == NULL); } - -#endif // !defined(OS_ANDROID) && !defined(OS_OPENBSD) && - // !defined(OS_WIN) && !defined(ADDRESS_SANITIZER) +#endif // !defined(MEMORY_TOOL_REPLACES_ALLOCATOR) +#endif // !defined(OS_ANDROID) && !defined(OS_OPENBSD) && !defined(OS_WIN) |