From 84525b26fe614b01d13d39741fd322ee4fadfa50 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Tue, 7 Feb 2023 17:15:59 +0100 Subject: [PATCH] test: remove timing-sensitive check (#3899) Remove expectations around uv_cond_timedwait() maximum sleep time. The OpenBSD buildbot sleeps more than 5x longer than requested. It no longer makes sense to expect some reasonable upper bound because at that point we've moved well beyond reasonable. Fixes: https://github.com/libuv/libuv/issues/3896 --- test/test-condvar.c | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/test/test-condvar.c b/test/test-condvar.c index 32abccc2..61592d0e 100644 --- a/test/test-condvar.c +++ b/test/test-condvar.c @@ -228,11 +228,6 @@ TEST_IMPL(condvar_4) { /* uv_cond_timedwait: One thread waits, no signal. Timeout should be delivered. */ TEST_IMPL(condvar_5) { worker_config wc; - int r; - /* ns */ - uint64_t before; - uint64_t after; - uint64_t elapsed; uint64_t timeout; timeout = 100 * 1000 * 1000; /* 100 ms in ns */ @@ -242,25 +237,11 @@ TEST_IMPL(condvar_5) { uv_mutex_lock(&wc.mutex); - /* We wait. - * No signaler, so this will only return if timeout is delivered. */ - before = uv_hrtime(); - r = uv_cond_timedwait(&wc.cond, &wc.mutex, timeout); - after = uv_hrtime(); + /* We wait. No signaler, so this will only return if timeout is delivered. */ + ASSERT_EQ(UV_ETIMEDOUT, uv_cond_timedwait(&wc.cond, &wc.mutex, timeout)); uv_mutex_unlock(&wc.mutex); - /* It timed out. */ - ASSERT(r == UV_ETIMEDOUT); - - /* It must have taken at least timeout, modulo system timer ticks. - * But it should not take too much longer. - * cf. MSDN docs: - * https://msdn.microsoft.com/en-us/library/ms687069(VS.85).aspx */ - elapsed = after - before; - ASSERT(0.75 * timeout <= elapsed); /* 1.0 too large for Windows. */ - ASSERT(elapsed <= 5.0 * timeout); /* MacOS has reported failures up to 1.75. */ - worker_config_destroy(&wc); return 0;