summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-07-01 09:43:16 +0200
committerNikita Popov <nikita.ppv@gmail.com>2019-07-01 09:43:16 +0200
commit5c0a9a4096081b7256dcf5410cce2ae03ffbe041 (patch)
tree2ccfdd7e8dc3d049abc41288678cd41f69cb23c7
parent736172d23d99f90420b917ec8b7999bd56e7ca1c (diff)
downloadphp-git-5c0a9a4096081b7256dcf5410cce2ae03ffbe041.tar.gz
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.
-rw-r--r--ext/standard/tests/misc/time_sleep_until_basic.phpt3
1 files changed, 2 insertions, 1 deletions
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";