Commit ec658b16 authored by Robin Cheng's avatar Robin Cheng Committed by Facebook GitHub Bot

Make SmallLocksTest pass under TSAN if halt_on_error=0.

Summary: When setting halt_on_error to 0 (which is the default setting now for TSAN in fbcode because we want to catch all bugs), a deadlock does not immediately cause an issue. So we include exit(0) as part of the death test to handle that case.

Reviewed By: yfeldblum

Differential Revision: D23493015

fbshipit-source-id: fb4910edddab11e1cd00e402b6b7350a6dc941a7
parent 81ee35a5
......@@ -204,7 +204,12 @@ TEST(SmallLocks, PicoSpinLockThreadSanitizer) {
{
std::lock_guard<Lock> gb(b);
EXPECT_DEATH(
[&]() { std::lock_guard<Lock> ga(a); }(),
[&]() {
std::lock_guard<Lock> ga(a);
// If halt_on_error is turned off for TSAN, then death would
// happen on exit, so give that a chance as well.
std::quick_exit(1);
}(),
"Cycle in lock order graph");
}
}
......@@ -431,7 +436,12 @@ TEST(SmallLocksk, MicroSpinLockThreadSanitizer) {
{
std::lock_guard<MicroSpinLock> gb(b);
EXPECT_DEATH(
[&]() { std::lock_guard<MicroSpinLock> ga(a); }(),
[&]() {
std::lock_guard<MicroSpinLock> ga(a);
// If halt_on_error is turned off for TSAN, then death would
// happen on exit, so give that a chance as well.
std::quick_exit(1);
}(),
"Cycle in lock order graph");
}
}
......@@ -452,6 +462,9 @@ TEST(SmallLocksk, MicroSpinLockThreadSanitizer) {
[&]() {
std::lock_guard<MicroSpinLock> ga(
*reinterpret_cast<MicroSpinLock*>(&a));
// If halt_on_error is turned off for TSAN, then death would
// happen on exit, so give that a chance as well.
std::quick_exit(1);
}(),
"Cycle in lock order graph");
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment