forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 phpGH-4969.
- Loading branch information
Showing
12 changed files
with
52 additions
and
202 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,19 @@ | ||
--TEST-- | ||
Timeout within array_walk | ||
Timeout within array_map | ||
--SKIPIF-- | ||
<?php | ||
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); | ||
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); | ||
if (PHP_OS_FAMILY !== "Windows") die("skip Windows only test"); | ||
?> | ||
--FILE-- | ||
<?php | ||
|
||
include __DIR__ . DIRECTORY_SEPARATOR . "timeout_config.inc"; | ||
set_time_limit(1); | ||
|
||
set_time_limit($t); | ||
$a = array(1, 1); | ||
array_map("sleep", $a); | ||
|
||
function cb(&$i, $k, $p) | ||
{ | ||
busy_wait(1); | ||
} | ||
|
||
$startTime = microtime(true); | ||
|
||
$a = array(1 => 1, 2 => 1, 3 => 1, 4 => 1, 5 => 1, 6 => 1, 7 => 1); | ||
array_walk($a, "cb", "junk"); | ||
|
||
$diff = microtime(true) - $startTime; | ||
echo "time spent waiting: $diff\n"; | ||
?> | ||
never reached here | ||
--EXPECTF-- | ||
Fatal error: Maximum execution time of 3 seconds exceeded in %s on line %d | ||
Fatal error: Maximum execution time of 1 second exceeded in %s on line %d |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters