Skip to content

Commit 904ee0f

Browse files
authoredMar 27, 2025··
Fix flaky work_beacon test (#6942)
1 parent 0ccd813 commit 904ee0f

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed
 

‎src/ds/test/work_beacon.cpp

+12-4
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,19 @@ TEST_CASE("WorkBeacon" * doctest::test_suite("workbeacon"))
194194
// First assert the order
195195
REQUIRE(wakes_with_beacon == 0);
196196
REQUIRE(wakes_with_beacon <= wakes_with_waits);
197-
REQUIRE(wakes_with_waits <= wakes_with_spinloop);
198197

199-
// Then try to be a little more precise, allowing head-room for
200-
// different build configs and cosmic rays
201-
REQUIRE(wakes_with_waits * 10 < wakes_with_spinloop);
198+
// In occasional runs on some build configurations, we see 0 wakes
199+
// when using the spinloop. This is surprising, but not impossible. In
200+
// this instance we obviously don't see any improvement in the waiting
201+
// scheme, so skip the following assertions
202+
if (wakes_with_spinloop > 0)
203+
{
204+
REQUIRE(wakes_with_waits < wakes_with_spinloop);
205+
206+
// Then try to be a little more precise, allowing head-room for
207+
// different build configs and cosmic rays
208+
REQUIRE(wakes_with_waits * 10 < wakes_with_spinloop);
209+
}
202210
}
203211
}
204212
}

0 commit comments

Comments
 (0)
Please sign in to comment.