summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/basic/timeout_config.inc6
-rw-r--r--tests/basic/timeout_variation_0.phpt11
-rw-r--r--tests/basic/timeout_variation_1.phpt6
-rw-r--r--tests/basic/timeout_variation_10.phpt6
-rw-r--r--tests/basic/timeout_variation_2.phpt8
-rw-r--r--tests/basic/timeout_variation_3.phpt6
-rw-r--r--tests/basic/timeout_variation_4.phpt6
-rw-r--r--tests/basic/timeout_variation_5.phpt6
-rw-r--r--tests/basic/timeout_variation_6.phpt6
-rw-r--r--tests/basic/timeout_variation_7.phpt10
-rw-r--r--tests/basic/timeout_variation_8.phpt12
-rw-r--r--tests/basic/timeout_variation_9.phpt6
12 files changed, 63 insertions, 26 deletions
diff --git a/tests/basic/timeout_config.inc b/tests/basic/timeout_config.inc
index e9a6c60e08..18a00b2c48 100644
--- a/tests/basic/timeout_config.inc
+++ b/tests/basic/timeout_config.inc
@@ -2,10 +2,10 @@
$t = 3;
-function busy_sleep($how_long)
+function busy_wait($how_long)
{
- $now = time();
+ $until = time() + $how_long;
- while($now + $how_long > time());
+ while ($until > time());
}
diff --git a/tests/basic/timeout_variation_0.phpt b/tests/basic/timeout_variation_0.phpt
index 51670d5208..6e7ef15ebc 100644
--- a/tests/basic/timeout_variation_0.phpt
+++ b/tests/basic/timeout_variation_0.phpt
@@ -1,19 +1,22 @@
--TEST--
Timeout within while loop
+--SKIPIF--
+<?php
+ if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
+?>
--FILE--
<?php
include dirname(__FILE__) . DIRECTORY_SEPARATOR . "timeout_config.inc";
+$t = 3;
set_time_limit($t);
-while(1) {
- echo 1;
- busy_sleep(1);
+while (1) {
+ busy_wait(1);
}
?>
never reached here
--EXPECTF--
-111
Fatal error: Maximum execution time of 3 seconds exceeded in %s on line %d
diff --git a/tests/basic/timeout_variation_1.phpt b/tests/basic/timeout_variation_1.phpt
index 3f2d238d02..4245d0b01b 100644
--- a/tests/basic/timeout_variation_1.phpt
+++ b/tests/basic/timeout_variation_1.phpt
@@ -1,5 +1,9 @@
--TEST--
Timeout within function
+--SKIPIF--
+<?php
+ if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
+?>
--FILE--
<?php
@@ -10,7 +14,7 @@ set_time_limit($t);
function hello ($t) {
echo "call";
- busy_sleep($t*2);
+ busy_wait($t*2);
}
hello($t);
diff --git a/tests/basic/timeout_variation_10.phpt b/tests/basic/timeout_variation_10.phpt
index edfb7127a6..b3d533d4dd 100644
--- a/tests/basic/timeout_variation_10.phpt
+++ b/tests/basic/timeout_variation_10.phpt
@@ -1,5 +1,9 @@
--TEST--
Timeout within shutdown function, variation
+--SKIPIF--
+<?php
+ if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
+?>
--FILE--
<?php
@@ -11,7 +15,7 @@ set_time_limit($t);
function f()
{
echo "call";
- busy_sleep(4);
+ busy_wait(4);
}
register_shutdown_function("f");
diff --git a/tests/basic/timeout_variation_2.phpt b/tests/basic/timeout_variation_2.phpt
index 74da955d7b..e591fc5bb3 100644
--- a/tests/basic/timeout_variation_2.phpt
+++ b/tests/basic/timeout_variation_2.phpt
@@ -1,5 +1,9 @@
--TEST--
Timeout within array_walk
+--SKIPIF--
+<?php
+ if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
+?>
--FILE--
<?php
@@ -10,8 +14,7 @@ set_time_limit($t);
function cb(&$i, $k, $p)
{
- echo 1;
- busy_sleep(1);
+ busy_wait(1);
}
$a = array(1 => 1, 2 => 1, 3 => 1, 4 => 1, 5 => 1, 6 => 1, 7 => 1);
@@ -20,5 +23,4 @@ array_walk($a, "cb", "junk");
?>
never reached here
--EXPECTF--
-111
Fatal error: Maximum execution time of 3 seconds exceeded in %s on line %d
diff --git a/tests/basic/timeout_variation_3.phpt b/tests/basic/timeout_variation_3.phpt
index 0c4b9e8e71..7bff09680e 100644
--- a/tests/basic/timeout_variation_3.phpt
+++ b/tests/basic/timeout_variation_3.phpt
@@ -1,5 +1,9 @@
--TEST--
Timeout within eval
+--SKIPIF--
+<?php
+ if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
+?>
--FILE--
<?php
@@ -10,7 +14,7 @@ set_time_limit($t);
function hello ($t) {
echo "call", PHP_EOL;
- busy_sleep($t*2);
+ busy_wait($t*2);
}
eval('hello($t);');
diff --git a/tests/basic/timeout_variation_4.phpt b/tests/basic/timeout_variation_4.phpt
index 102b92afa6..6fccce87a4 100644
--- a/tests/basic/timeout_variation_4.phpt
+++ b/tests/basic/timeout_variation_4.phpt
@@ -1,5 +1,9 @@
--TEST--
Timeout within call_user_func
+--SKIPIF--
+<?php
+ if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
+?>
--FILE--
<?php
@@ -10,7 +14,7 @@ set_time_limit($t);
function hello ($t) {
echo "call", PHP_EOL;
- busy_sleep($t*2);
+ busy_wait($t*2);
}
call_user_func('hello', $t);
diff --git a/tests/basic/timeout_variation_5.phpt b/tests/basic/timeout_variation_5.phpt
index 38dde0d759..493c31c151 100644
--- a/tests/basic/timeout_variation_5.phpt
+++ b/tests/basic/timeout_variation_5.phpt
@@ -1,5 +1,9 @@
--TEST--
Timeout within function containing exteption
+--SKIPIF--
+<?php
+ if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
+?>
--FILE--
<?php
@@ -10,7 +14,7 @@ set_time_limit($t);
function f($t) {
echo "call";
- busy_sleep($t*2);
+ busy_wait($t*2);
throw new Exception("never reached here");
}
diff --git a/tests/basic/timeout_variation_6.phpt b/tests/basic/timeout_variation_6.phpt
index 355354fa1a..70c83945cc 100644
--- a/tests/basic/timeout_variation_6.phpt
+++ b/tests/basic/timeout_variation_6.phpt
@@ -1,5 +1,9 @@
--TEST--
Timeout within function trowing exteption before timeout reached
+--SKIPIF--
+<?php
+ if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
+?>
--FILE--
<?php
@@ -10,7 +14,7 @@ set_time_limit($t);
function f($t) {
echo "call";
- busy_sleep($t-1);
+ busy_wait($t-1);
throw new Exception("exception before timeout");
}
diff --git a/tests/basic/timeout_variation_7.phpt b/tests/basic/timeout_variation_7.phpt
index 5ae8e07a0d..9dfed2083b 100644
--- a/tests/basic/timeout_variation_7.phpt
+++ b/tests/basic/timeout_variation_7.phpt
@@ -1,5 +1,9 @@
--TEST--
Timeout within for loop
+--SKIPIF--
+<?php
+ if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
+?>
--FILE--
<?php
@@ -8,13 +12,11 @@ include dirname(__FILE__) . DIRECTORY_SEPARATOR . "timeout_config.inc";
$t = 3;
set_time_limit($t);
-for($i = 0; $i < 42; $i++) {
- echo 1;
- busy_sleep(1);
+for ($i = 0; $i < 42; $i++) {
+ busy_wait(1);
}
?>
never reached here
--EXPECTF--
-111
Fatal error: Maximum execution time of 3 seconds exceeded in %s on line %d
diff --git a/tests/basic/timeout_variation_8.phpt b/tests/basic/timeout_variation_8.phpt
index 25a208cca7..ab3724edb7 100644
--- a/tests/basic/timeout_variation_8.phpt
+++ b/tests/basic/timeout_variation_8.phpt
@@ -1,20 +1,22 @@
--TEST--
Timeout within foreach loop
+--SKIPIF--
+<?php
+ if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
+?>
--FILE--
<?php
+$t = 3;
include dirname(__FILE__) . DIRECTORY_SEPARATOR . "timeout_config.inc";
-$t = 3;
set_time_limit($t);
-foreach(range(0, 42) as $i) {
- echo 1;
- busy_sleep(1);
+foreach (range(0, 42) as $i) {
+ busy_wait(1);
}
?>
never reached here
--EXPECTF--
-111
Fatal error: Maximum execution time of 3 seconds exceeded in %s on line %d
diff --git a/tests/basic/timeout_variation_9.phpt b/tests/basic/timeout_variation_9.phpt
index 520b0ee35d..003cd05bf8 100644
--- a/tests/basic/timeout_variation_9.phpt
+++ b/tests/basic/timeout_variation_9.phpt
@@ -1,5 +1,9 @@
--TEST--
Timeout within shutdown function
+--SKIPIF--
+<?php
+ if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
+?>
--FILE--
<?php
@@ -11,7 +15,7 @@ set_time_limit($t);
function f()
{
echo "call";
- busy_sleep(4);
+ busy_wait(4);
}
register_shutdown_function("f");