diff options
author | wfh@chromium.org <wfh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-08 23:57:24 +0000 |
---|---|---|
committer | wfh@chromium.org <wfh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-08 23:57:24 +0000 |
commit | 9300f81845cc5d3bb2b5fe6c6b8797d6c733d4f5 (patch) | |
tree | f2c885e05165b9dc378b84d14528a6b29146607c /base | |
parent | 3441c09a309827cf77c50f23f37a6dd486462e60 (diff) | |
download | chromium_src-9300f81845cc5d3bb2b5fe6c6b8797d6c733d4f5.zip chromium_src-9300f81845cc5d3bb2b5fe6c6b8797d6c733d4f5.tar.gz chromium_src-9300f81845cc5d3bb2b5fe6c6b8797d6c733d4f5.tar.bz2 |
Disable ProcessUtilTest.CalcFreeMemory total memory test when using tcmalloc.
This is because tcmalloc has an allocation strategy that sometimes causes this test to be flaky when it's enabled for base_unittests.
BUG=247398
Review URL: https://chromiumcodereview.appspot.com/16634009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@205088 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/process_util_unittest.cc | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/base/process_util_unittest.cc b/base/process_util_unittest.cc index 99e9f3f..d3a4100 100644 --- a/base/process_util_unittest.cc +++ b/base/process_util_unittest.cc @@ -466,6 +466,15 @@ TEST_F(ProcessUtilTest, CalcFreeMemory) { base::ProcessMetrics::CreateProcessMetrics(::GetCurrentProcess())); ASSERT_TRUE(NULL != metrics.get()); + bool using_tcmalloc = false; + + // Detect if we are using tcmalloc +#if !defined(NO_TCMALLOC) + const char* chrome_allocator = getenv("CHROME_ALLOCATOR"); + if (!chrome_allocator || _stricmp(chrome_allocator, "tcmalloc") == 0) + using_tcmalloc = true; +#endif + // Typical values here is ~1900 for total and ~1000 for largest. Obviously // it depends in what other tests have done to this process. base::FreeMBytes free_mem1 = {0}; @@ -486,7 +495,11 @@ TEST_F(ProcessUtilTest, CalcFreeMemory) { base::FreeMBytes free_mem2 = {0}; EXPECT_TRUE(metrics->CalculateFreeMemory(&free_mem2)); EXPECT_GE(free_mem2.total, free_mem2.largest); - EXPECT_GE(expected_total, free_mem2.total); + // This test is flaky when using tcmalloc, because tcmalloc + // allocation strategy sometimes results in less than the + // full drop of 20Mb of free memory. + if (!using_tcmalloc) + EXPECT_GE(expected_total, free_mem2.total); EXPECT_GE(expected_largest, free_mem2.largest); EXPECT_TRUE(NULL != free_mem2.largest_ptr); } |