From 5c0a9a4096081b7256dcf5410cce2ae03ffbe041 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 1 Jul 2019 09:43:16 +0200 Subject: [PATCH] Add some tolerance to time_sleep_until() test This has been sporadically failing on macos for a while. We've tried a couple of things (using int arithmetic, normalizing to gettimeofday), but this issue remains. I'm adding some tolerance to the test to avoid CI failures. --- ext/standard/tests/misc/time_sleep_until_basic.phpt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ext/standard/tests/misc/time_sleep_until_basic.phpt b/ext/standard/tests/misc/time_sleep_until_basic.phpt index 25c17ab9a7..b0d3c8eea5 100644 --- a/ext/standard/tests/misc/time_sleep_until_basic.phpt +++ b/ext/standard/tests/misc/time_sleep_until_basic.phpt @@ -29,7 +29,8 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { $now = $tmp >= (int)$time ? $tmp : $tmp + .05; } -if ($now >= $sleepUntil) { +// Add some tolerance for early wake on macos. Reason unknown. +if ($now + 0.001 >= $sleepUntil) { echo "Success\n"; } else { echo "Sleep until (before truncation): ", $time, "\n"; -- 2.40.0