mirror of
https://github.com/php/php-src.git
synced 2024-11-24 02:15:04 +08:00
Improve the error message in timeout tests
Closes GH-4818.
This commit is contained in:
parent
4b3e041f5b
commit
62b053a3be
@ -14,7 +14,10 @@ set_time_limit($t);
|
||||
function f()
|
||||
{
|
||||
echo "call";
|
||||
$startTime = microtime(true);
|
||||
busy_wait(5);
|
||||
$diff = microtime(true) - $startTime;
|
||||
echo "\ntime spent waiting: $diff\n";
|
||||
}
|
||||
|
||||
register_shutdown_function("f");
|
||||
|
@ -16,9 +16,13 @@ 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--
|
||||
|
@ -13,7 +13,10 @@ set_time_limit($t);
|
||||
|
||||
function hello ($t) {
|
||||
echo "call", PHP_EOL;
|
||||
$startTime = microtime(true);
|
||||
busy_wait($t*2);
|
||||
$diff = microtime(true) - $startTime;
|
||||
echo "time spent waiting: $diff\n";
|
||||
}
|
||||
|
||||
eval('hello($t);');
|
||||
|
@ -13,7 +13,10 @@ set_time_limit($t);
|
||||
|
||||
function hello ($t) {
|
||||
echo "call", PHP_EOL;
|
||||
$startTime = microtime(true);
|
||||
busy_wait($t*2);
|
||||
$diff = microtime(true) - $startTime;
|
||||
echo "time spent waiting: $diff\n";
|
||||
}
|
||||
|
||||
call_user_func('hello', $t);
|
||||
|
@ -13,8 +13,10 @@ set_time_limit($t);
|
||||
|
||||
function f($t) {
|
||||
echo "call";
|
||||
$startTime = microtime(true);
|
||||
busy_wait($t*2);
|
||||
throw new Exception("never reached here");
|
||||
$diff = microtime(true) - $startTime;
|
||||
throw new Exception("never reached here (time spent waiting: $diff)");
|
||||
}
|
||||
|
||||
f($t);
|
||||
|
@ -11,10 +11,15 @@ include __DIR__ . DIRECTORY_SEPARATOR . "timeout_config.inc";
|
||||
|
||||
set_time_limit($t);
|
||||
|
||||
$startTime = microtime(true);
|
||||
|
||||
for ($i = 0; $i < 42; $i++) {
|
||||
busy_wait(1);
|
||||
}
|
||||
|
||||
$diff = microtime(true) - $startTime;
|
||||
echo "time spent waiting: $diff\n";
|
||||
|
||||
?>
|
||||
never reached here
|
||||
--EXPECTF--
|
||||
|
@ -11,10 +11,15 @@ include __DIR__ . DIRECTORY_SEPARATOR . "timeout_config.inc";
|
||||
|
||||
set_time_limit($t);
|
||||
|
||||
$startTime = microtime(true);
|
||||
|
||||
foreach (range(0, 42) as $i) {
|
||||
busy_wait(1);
|
||||
}
|
||||
|
||||
$diff = microtime(true) - $startTime;
|
||||
echo "time spent waiting: $diff\n";
|
||||
|
||||
?>
|
||||
never reached here
|
||||
--EXPECTF--
|
||||
|
@ -14,7 +14,10 @@ set_time_limit($t);
|
||||
function f()
|
||||
{
|
||||
echo "call";
|
||||
$startTime = microtime(true);
|
||||
busy_wait(5);
|
||||
$diff = microtime(true) - $startTime;
|
||||
echo "\ntime spent waiting: $diff\n";
|
||||
}
|
||||
|
||||
register_shutdown_function("f");
|
||||
|
Loading…
Reference in New Issue
Block a user