summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-07-08 13:26:59 +0200
committerNikita Popov <nikita.ppv@gmail.com>2019-07-08 13:35:29 +0200
commit392398bfe63b43288a0fbd301491b564eb24dfe9 (patch)
tree49a44357f205bae6dbd17e36486acb888b332bd1 /tests
parent9a833438d184bcc7198c609117b27a321f20d22c (diff)
downloadphp-git-392398bfe63b43288a0fbd301491b564eb24dfe9.tar.gz
Make busy wait busier
Another stab in the dark to fix the intermittent failures of timeout tests on macos CI: We're using ITIMER_PROF, which means that the timer counts against user+system time. The "busy" wait loop counts against real time. Currently it calls microtime() on every iteration. If that call is implemented as a syscall rather than going through vDSO or commpage we might be seeing many context switches here which drive up the real time, but not user or system time. See if making the loop busier and calling microtime() less helps the situation.
Diffstat (limited to 'tests')
-rw-r--r--tests/basic/timeout_config.inc10
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/basic/timeout_config.inc b/tests/basic/timeout_config.inc
index 3bd9eeaa70..5cd156f471 100644
--- a/tests/basic/timeout_config.inc
+++ b/tests/basic/timeout_config.inc
@@ -2,9 +2,9 @@
$t = 3;
-function busy_wait($how_long)
-{
- $until = microtime(TRUE) + $how_long;
-
- while ($until > microtime(TRUE));
+function busy_wait($how_long) {
+ $until = microtime(true) + $how_long;
+ do {
+ for ($i = 0; $i < 1000000; $i++);
+ } while ($until > microtime(true));
}