Commit 5c8fd42b authored by Avi Drissman's avatar Avi Drissman Committed by Commit Bot

Turn down OOM memory test allocation a wee bit

The OOM death tests used an allocation value of MAX_LONG minus 12k.
The problem with that value is that, on systems like the Mac DTKs
that have 16k VM pages, that gets rounded up and wraps. Therefore,
abstract it into “subtract three pages”.

Bug: 1121749
Change-Id: I6c519200cbd848c095b741d78f51317ea6ef18b8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2376887
Commit-Queue: Avi Drissman <avi@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: default avatarMark Mentovai <mark@chromium.org>
Auto-Submit: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#801831}
parent 4e274ffd
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "base/debug/alias.h" #include "base/debug/alias.h"
#include "base/memory/aligned_memory.h" #include "base/memory/aligned_memory.h"
#include "base/process/process_metrics.h"
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
...@@ -129,9 +130,10 @@ class OutOfMemoryTest : public testing::Test { ...@@ -129,9 +130,10 @@ class OutOfMemoryTest : public testing::Test {
public: public:
OutOfMemoryTest() OutOfMemoryTest()
: value_(nullptr), : value_(nullptr),
// Make test size as large as possible minus a few pages so // Make test size as large as possible minus a few pages so that
// that alignment or other rounding doesn't make it wrap. // alignment or other rounding doesn't make it wrap.
test_size_(std::numeric_limits<std::size_t>::max() - 12 * 1024), test_size_(std::numeric_limits<std::size_t>::max() -
3 * base::GetPageSize()),
// A test size that is > 2Gb and will cause the allocators to reject // A test size that is > 2Gb and will cause the allocators to reject
// the allocation due to security restrictions. See crbug.com/169327. // the allocation due to security restrictions. See crbug.com/169327.
insecure_test_size_(std::numeric_limits<int>::max()), insecure_test_size_(std::numeric_limits<int>::max()),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment