Skip to content

Commit bc1b635

Browse files
yfeldblumfacebook-github-bot
authored andcommitted
omit rather than skip tsan-only small-locks tests
Summary: There are some tests which intentionally deadlock and which are intended to cause thread sanitizer to trap. Omit them rather than skip in all other build modes. Reviewed By: dmm-fb Differential Revision: D76613045 fbshipit-source-id: 67531375f4d7357762e890a554fd5d852528a87a
1 parent 9752914 commit bc1b635

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

third-party/folly/src/folly/synchronization/test/SmallLocksTest.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,9 @@ TEST(SmallLocks, PicoSpinSigned) {
179179
EXPECT_EQ(val.getData(), -8);
180180
}
181181

182-
TEST(SmallLocks, PicoSpinLockThreadSanitizer) {
183-
SKIP_IF(!folly::kIsSanitizeThread) << "Enabled in TSAN mode only";
182+
#if FOLLY_SANITIZE_THREAD
184183

184+
TEST(SmallLocks, PicoSpinLockThreadSanitizer) {
185185
typedef PicoSpinLock<int16_t, 0> Lock;
186186

187187
{
@@ -207,6 +207,8 @@ TEST(SmallLocks, PicoSpinLockThreadSanitizer) {
207207
}
208208
}
209209

210+
#endif
211+
210212
TEST(SmallLocks, RegClobber) {
211213
TestClobber().go();
212214
}
@@ -439,9 +441,9 @@ TEST(SmallLocks, MicroSpinLockStressTestTryLockHardwareConcurrency) {
439441
simpleStressTestTryLock<MicroSpinLock>(duration, threads);
440442
}
441443

442-
TEST(SmallLocksk, MicroSpinLockThreadSanitizer) {
443-
SKIP_IF(!folly::kIsSanitizeThread) << "Enabled in TSAN mode only";
444+
#if FOLLY_SANITIZE_THREAD
444445

446+
TEST(SmallLocks, MicroSpinLockThreadSanitizer) {
445447
uint8_t val = 0;
446448
static_assert(sizeof(uint8_t) == sizeof(MicroSpinLock), "sanity check");
447449
// make sure TSAN handles this case too:
@@ -497,6 +499,8 @@ TEST(SmallLocksk, MicroSpinLockThreadSanitizer) {
497499
}
498500
}
499501

502+
#endif
503+
500504
TEST(SmallLocks, PicoSpinLockStressTestTryLockTwoThreads) {
501505
auto duration = std::chrono::seconds{FLAGS_stress_test_seconds};
502506
simpleStressTestTryLock<PicoSpinLock<std::uint16_t>>(duration, 2);

0 commit comments

Comments
 (0)