Skip to content

Commit 66841e8

Browse files
committed
Merge pull request #198 from stesie/slow-down-time-limit-tests
Make set_time_limit tests slower
2 parents 44c3ce7 + adb8288 commit 66841e8

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

tests/set_time_limit_002.phpt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ var jsfunc = function() {
1111
var start = (new Date()).getTime();
1212
1313
var text = "abcdefghijklmnopqrstuvwyxz0123456789";
14-
while ((new Date()).getTime() - start < 500) {
15-
/* pass at least 500ms in the loop so the timer loop has plenty of
14+
while ((new Date()).getTime() - start < 800) {
15+
/* pass at least 800ms in the loop so the timer loop has plenty of
1616
* time to trigger. */
1717
var encoded = encodeURI(text);
1818
}
@@ -22,10 +22,10 @@ EOT;
2222

2323
$v8 = new V8Js();
2424
/* Set very short time limit, but enough so v8 can start up safely. */
25-
$v8->setTimeLimit(100);
25+
$v8->setTimeLimit(200);
2626

2727
$v8->incrTimeLimit = function() use ($v8) {
28-
$v8->setTimeLimit(300);
28+
$v8->setTimeLimit(500);
2929
};
3030

3131
$func = $v8->executeString($JS);
@@ -43,5 +43,5 @@ try {
4343
object(V8Function)#%d (0) {
4444
}
4545
V8JsTimeLimitException
46-
Script time limit of 300 milliseconds exceeded
46+
Script time limit of 500 milliseconds exceeded
4747
===EOF===

tests/set_time_limit_004.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Test V8::setTimeLimit() : Time limit can be prolonged
77

88
$JS = <<< EOT
99
var text = "abcdefghijklmnopqrstuvwyxz0123456789";
10-
/* Spend 30 * >10ms in the loop, i.e. at least 300ms; hence
10+
/* Spend 75 * >10ms in the loop, i.e. at least 750ms; hence
1111
* it should be killed if prolonging doesn't work. */
1212
for (var j = 0; j < 30; ++j) {
1313
PHP.prolongTimeLimit();
@@ -22,10 +22,10 @@ for (var j = 0; j < 30; ++j) {
2222
EOT;
2323

2424
$v8 = new V8Js();
25-
$v8->setTimeLimit(100);
25+
$v8->setTimeLimit(300);
2626

2727
$v8->prolongTimeLimit = function() use ($v8) {
28-
$v8->setTimeLimit(100);
28+
$v8->setTimeLimit(300);
2929
};
3030

3131
$v8->executeString($JS);

0 commit comments

Comments
 (0)