Commit 96105657 authored by Kenton Varda's avatar Kenton Varda

Make AsyncUnixTest/InterruptedTimer slower on Linux becaues it turns out to be…

Make AsyncUnixTest/InterruptedTimer slower on Linux becaues it turns out to be flaky on machines other than mine.
parent ca1ecb04
......@@ -594,17 +594,16 @@ TEST(AsyncUnixTest, InterruptedTimer) {
constexpr auto OS_SLOWNESS_FACTOR = 1;
#else
// OSX timeslices are 10ms, so we need longer timeouts to avoid flakiness.
// In fact, even 10x doesn't make OSX happy so we're pushing it to 100x.
// To be safe we'll assume other OS's are similar.
constexpr auto OS_SLOWNESS_FACTOR = 100;
constexpr auto OS_SLOWNESS_FACTOR = 10;
#endif
// Schedule a timer event in 10ms.
// Schedule a timer event in 100ms.
auto& timer = port.getTimer();
auto start = timer.now();
constexpr auto timeout = 10 * MILLISECONDS * OS_SLOWNESS_FACTOR;
constexpr auto timeout = 100 * MILLISECONDS * OS_SLOWNESS_FACTOR;
// Arrange SIGALRM to be delivered in 5ms, handled in an empty signal handler. This will cause
// Arrange SIGALRM to be delivered in 50ms, handled in an empty signal handler. This will cause
// our wait to be interrupted with EINTR. We should nevertheless continue waiting for the right
// amount of time.
dummySignalHandlerCalled = false;
......@@ -613,14 +612,14 @@ TEST(AsyncUnixTest, InterruptedTimer) {
}
struct itimerval itv;
memset(&itv, 0, sizeof(itv));
itv.it_value.tv_usec = 5000 * OS_SLOWNESS_FACTOR; // signal after 5ms
itv.it_value.tv_usec = 50000 * OS_SLOWNESS_FACTOR; // signal after 50ms
setitimer(ITIMER_REAL, &itv, nullptr);
timer.afterDelay(timeout).wait(waitScope);
KJ_EXPECT(dummySignalHandlerCalled);
KJ_EXPECT(timer.now() - start >= timeout);
KJ_EXPECT(timer.now() - start <= timeout + (timeout / 5)); // allow 2ms error
KJ_EXPECT(timer.now() - start <= timeout + (timeout / 5)); // allow 20ms error
}
TEST(AsyncUnixTest, Wake) {
......
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