diff options
author | glider@chromium.org <glider@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-23 11:28:17 +0000 |
---|---|---|
committer | glider@chromium.org <glider@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-23 11:28:17 +0000 |
commit | a40579898cd2dcd3329597647b93c1b460c759ed (patch) | |
tree | 7368680697a0d3bca873e2a7839fec8a6f5a44aa /base | |
parent | 8a92186440f108c66ea0bba904d2e41b6ce9ed8c (diff) | |
download | chromium_src-a40579898cd2dcd3329597647b93c1b460c759ed.zip chromium_src-a40579898cd2dcd3329597647b93c1b460c759ed.tar.gz chromium_src-a40579898cd2dcd3329597647b93c1b460c759ed.tar.bz2 |
Fix ToolsSanityTest.DataRace under TSan v1 by allocating the shared variable on the heap instead of stack.
For some reason the test interferes with others and the race on the stack variable gets ignored.
BUG=223016
TBR=thestig,darin
Review URL: https://codereview.chromium.org/13040003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@190002 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/tools_sanity_unittest.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/base/tools_sanity_unittest.cc b/base/tools_sanity_unittest.cc index 21dc0e2..006d142 100644 --- a/base/tools_sanity_unittest.cc +++ b/base/tools_sanity_unittest.cc @@ -247,10 +247,11 @@ void RunInParallel(PlatformThread::Delegate *d1, PlatformThread::Delegate *d2) { // A data race detector should report an error in this test. TEST(ToolsSanityTest, DataRace) { - bool shared = false; - TOOLS_SANITY_TEST_CONCURRENT_THREAD thread1(&shared), thread2(&shared); + bool *shared = new bool(false); + TOOLS_SANITY_TEST_CONCURRENT_THREAD thread1(shared), thread2(shared); RunInParallel(&thread1, &thread2); - EXPECT_TRUE(shared); + EXPECT_TRUE(*shared); + delete shared; } TEST(ToolsSanityTest, AnnotateBenignRace) { |