Chromium Code Reviews| Index: base/tools_sanity_unittest.cc |
| diff --git a/base/tools_sanity_unittest.cc b/base/tools_sanity_unittest.cc |
| index 7d4c96eb5f71c6cb080fa96971233b235724cbba..62d97a3710d8228fff581bf370b75184885f143e 100644 |
| --- a/base/tools_sanity_unittest.cc |
| +++ b/base/tools_sanity_unittest.cc |
| @@ -287,15 +287,29 @@ void RunInParallel(PlatformThread::Delegate *d1, PlatformThread::Delegate *d2) { |
| PlatformThread::Join(b); |
| } |
| -} // namespace |
| - |
| -// A data race detector should report an error in this test. |
| -TEST(ToolsSanityTest, DataRace) { |
| +void DataRace() { |
| bool *shared = new bool(false); |
| TOOLS_SANITY_TEST_CONCURRENT_THREAD thread1(shared), thread2(shared); |
| RunInParallel(&thread1, &thread2); |
| EXPECT_TRUE(*shared); |
| delete shared; |
| +#if defined(THREAD_SANITIZER) |
| + // We're in a death test - crash. |
| + CHECK(0); |
| +#endif |
| +} |
| + |
| +} // namespace |
| + |
| +// A data race detector should report an error in this test. |
| +TEST(ToolsSanityTest, DataRace) { |
| +#if defined(THREAD_SANITIZER) |
| + // The suppression regexp must match that in base/debug/tsan_suppressions.cc. |
| + EXPECT_DEATH(DataRace(), "1 race:base/tools_sanity_unittest.cc"); |
| +#else |
| + // TODO(glider): remove this path when TSan v1 is retired. |
|
Nico
2014/06/25 16:10:22
Isn't this done?
|
| + DataRace(); |
| +#endif |
| } |
| TEST(ToolsSanityTest, AnnotateBenignRace) { |