From a40579898cd2dcd3329597647b93c1b460c759ed Mon Sep 17 00:00:00 2001 From: "glider@chromium.org" Date: Sat, 23 Mar 2013 11:28:17 +0000 Subject: 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 --- base/tools_sanity_unittest.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'base') 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) { -- cgit v1.1