From cdee607d482ad8b9f665541d3f092dd11f72e508 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Tue, 12 Feb 2019 16:01:00 +0100 Subject: [PATCH] test: relax uv_hrtime() test assumptions Expecting `uv_sleep(45)` to wake up within 80 ms is not a reasonable assumption: the operating system may not reschedule the process within that time frame when the system is overloaded. The test fails intermittently on our own CI and packagers have reported similar failures. Fixes: https://github.com/libuv/libuv/issues/2117 PR-URL: https://github.com/libuv/libuv/pull/2186 Reviewed-By: Colin Ihrig Reviewed-By: Santiago Gimeno --- test/test-hrtime.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/test/test-hrtime.c b/test/test-hrtime.c index fbe9a68b..9d461d96 100644 --- a/test/test-hrtime.c +++ b/test/test-hrtime.c @@ -41,13 +41,11 @@ TEST_IMPL(hrtime) { diff = b - a; - /* printf("i= %d diff = %llu\n", i, (unsigned long long int) diff); */ - /* The windows Sleep() function has only a resolution of 10-20 ms. Check - * that the difference between the two hrtime values is somewhat in the - * range we expect it to be. */ + * that the difference between the two hrtime values has a reasonable + * lower bound. + */ ASSERT(diff > (uint64_t) 25 * NANOSEC / MILLISEC); - ASSERT(diff < (uint64_t) 80 * NANOSEC / MILLISEC); --i; } return 0;