From dfb6dabeb9e3349b6a3d0f387efa8045388c3dd5 Mon Sep 17 00:00:00 2001
From: Marcus Comstedt <marcus@mc.pp.se>
Date: Fri, 30 Apr 2021 17:38:08 +0200
Subject: [PATCH] Testsuite: Relax upper bound of gethrtime() test

On macos Big Sur, the sleep(2.0) call can overshoot the target by
0.12-0.15 s if the system is otherwise idle (this is presumably
related to the "napping" feature).  This is not really an error since
sleep only guarantees that _at least_ the requested time will elapse.

Adjust the upper bound of the accepted interval to be T+0.2, but
keep the lower bound at T-0.1.
---
 src/testsuite.in | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/testsuite.in b/src/testsuite.in
index d63a5ed7ae..69eefdabce 100644
--- a/src/testsuite.in
+++ b/src/testsuite.in
@@ -12544,10 +12544,10 @@ test_any([[
    float f=t2-t1;
 
    array r=({});
-   if (e<tts-0.1 || e>tts+0.1) 
+   if (e<tts-0.1 || e>tts+0.2)
       r+=({sprintf("hrtime %.6f, %+.6f",e,e-tts)});
 
-   if (f<tts-0.1 || f>tts+0.1) 
+   if (f<tts-0.1 || f>tts+0.2)
       r+=({sprintf("timeofday %.6f, %+.6f",f,f-tts)});
 
    if (sizeof(r)) return r*" / ";
-- 
GitLab