mirror of
https://github.com/php/php-src.git
synced 2024-12-22 16:30:02 +08:00
e760d94f4b
After taking a more detailed look at our commonly failing timeout tests... turns out that most of them are useless as written and don't test what they're supposed to. This PR has a couple of changes: * Tests for timeout in while/for/foreach should just have the loop as an infinite loop. Calling into something like busy_wait means that we just end up always testing whatever busy_wait does. * Tests for timeouts in calls need to be based on something like sleep, otherwise we'd have to introduce a loop, and we'd end up testing timeout of the looping structure instead. Using sleep only works on Windows, because that's the only system where sleep counts towards the timeout. As such, many of those tests are now Windows only. * Removed some tests where I don't see a good way to test what they're supposed to test. E.g. how can we test a timeout in eval() specifically? The shutdown function tests are marked as XFAIL, as we are currently missing a timeout check in call_user_function. I believe that's a legitimate issue. Closes GH-4969.
21 lines
303 B
PHP
21 lines
303 B
PHP
--TEST--
|
|
Timeout within for loop
|
|
--SKIPIF--
|
|
<?php
|
|
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
|
|
set_time_limit(1);
|
|
|
|
$y = 0;
|
|
for ($i = 0; $i < INF; $i++) {
|
|
$y++;
|
|
}
|
|
|
|
?>
|
|
never reached here
|
|
--EXPECTF--
|
|
Fatal error: Maximum execution time of 1 second exceeded in %s on line %d
|