diff options
author | Fabien Villepinte <fabien.villepinte@gmail.com> | 2019-10-20 10:55:27 +0200 |
---|---|---|
committer | Fabien Villepinte <fabien.villepinte@gmail.com> | 2019-10-20 10:55:27 +0200 |
commit | 62b053a3be3e77186451a503f93287a6002b62a0 (patch) | |
tree | 2c7f59262f9c991b448669587218ef00ccad6756 /tests | |
parent | 4b3e041f5bc75e8dc0fde49da32008e27f9bc40a (diff) | |
download | php-git-62b053a3be3e77186451a503f93287a6002b62a0.tar.gz |
Improve the error message in timeout tests
Closes GH-4818.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/basic/timeout_variation_10.phpt | 3 | ||||
-rw-r--r-- | tests/basic/timeout_variation_2.phpt | 4 | ||||
-rw-r--r-- | tests/basic/timeout_variation_3.phpt | 3 | ||||
-rw-r--r-- | tests/basic/timeout_variation_4.phpt | 3 | ||||
-rw-r--r-- | tests/basic/timeout_variation_5.phpt | 4 | ||||
-rw-r--r-- | tests/basic/timeout_variation_7.phpt | 5 | ||||
-rw-r--r-- | tests/basic/timeout_variation_8.phpt | 5 | ||||
-rw-r--r-- | tests/basic/timeout_variation_9.phpt | 3 |
8 files changed, 29 insertions, 1 deletions
diff --git a/tests/basic/timeout_variation_10.phpt b/tests/basic/timeout_variation_10.phpt index 59bb289def..44e1b93135 100644 --- a/tests/basic/timeout_variation_10.phpt +++ b/tests/basic/timeout_variation_10.phpt @@ -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"); diff --git a/tests/basic/timeout_variation_2.phpt b/tests/basic/timeout_variation_2.phpt index 41efe1a907..4acf5cd219 100644 --- a/tests/basic/timeout_variation_2.phpt +++ b/tests/basic/timeout_variation_2.phpt @@ -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-- diff --git a/tests/basic/timeout_variation_3.phpt b/tests/basic/timeout_variation_3.phpt index ea48ac97da..317d1b44ab 100644 --- a/tests/basic/timeout_variation_3.phpt +++ b/tests/basic/timeout_variation_3.phpt @@ -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);'); diff --git a/tests/basic/timeout_variation_4.phpt b/tests/basic/timeout_variation_4.phpt index e54c8d67d5..98f4d6ca8e 100644 --- a/tests/basic/timeout_variation_4.phpt +++ b/tests/basic/timeout_variation_4.phpt @@ -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); diff --git a/tests/basic/timeout_variation_5.phpt b/tests/basic/timeout_variation_5.phpt index 37af60ded4..6915623c6b 100644 --- a/tests/basic/timeout_variation_5.phpt +++ b/tests/basic/timeout_variation_5.phpt @@ -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); diff --git a/tests/basic/timeout_variation_7.phpt b/tests/basic/timeout_variation_7.phpt index 526c8f015d..849ac55e0d 100644 --- a/tests/basic/timeout_variation_7.phpt +++ b/tests/basic/timeout_variation_7.phpt @@ -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-- diff --git a/tests/basic/timeout_variation_8.phpt b/tests/basic/timeout_variation_8.phpt index 4c0dfaa8f7..51022250f0 100644 --- a/tests/basic/timeout_variation_8.phpt +++ b/tests/basic/timeout_variation_8.phpt @@ -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-- diff --git a/tests/basic/timeout_variation_9.phpt b/tests/basic/timeout_variation_9.phpt index bfd8ca2b52..ffe4553e49 100644 --- a/tests/basic/timeout_variation_9.phpt +++ b/tests/basic/timeout_variation_9.phpt @@ -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"); |