Skip to content
This repository was archived by the owner on Mar 29, 2024. It is now read-only.

Commit 090ca9c

Browse files
committed
Increase timeout upper limit to pass tests under valgrind
1 parent a9fbe2e commit 090ca9c

4 files changed

+14
-18
lines changed

tests/.testsuite.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,11 @@ public function dump_object_methods($object, array $arguments = [], FilterInterf
267267
echo $rc->getName(), $info, $access, $m->getName(), '():', $final_res, PHP_EOL;
268268
}
269269
}
270+
271+
public function need_more_time() {
272+
// NOTE: this check is a bit fragile but should fits our need
273+
return isset($_ENV['TRAVIS']) && isset($_ENV['TEST_PHP_ARGS']) && $_ENV['TEST_PHP_ARGS'] == '-m';
274+
}
270275
}
271276

272277
interface FilterInterface

tests/V8Isolate_limit_time.phpt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,15 @@ $file_name = 'test.js';
2525

2626
$script = new V8\Script($context, new \V8\StringValue($isolate, $source), new \V8\ScriptOrigin($file_name));
2727

28-
// NOTE: this check is a bit fragile but should fits our need
29-
$needs_more_time = isset($_ENV['TRAVIS']) && isset($_ENV['TEST_PHP_ARGS']) && $_ENV['TEST_PHP_ARGS'] == '-m';
30-
31-
if ($needs_more_time) {
28+
if ($helper->need_more_time()) {
3229
// On travis when valgrind active it takes more time to complete all operations so we just increase initial limits
3330
$time_limit = 5.0;
3431
$low_range = 4.5;
35-
$high_range = 7.5;
32+
$high_range = 10.0;
3633
} else {
3734
$time_limit = 1.5;
3835
$low_range = 1.45;
39-
$high_range = 1.6;
36+
$high_range = 1.65;
4037
}
4138

4239
$helper->assert('Time limit accessor report no hit', false === $isolate->IsTimeLimitHit());

tests/V8Isolate_limit_time_nested.phpt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,15 @@ $file_name1 = 'test.js';
5757

5858
$script1 = new V8\Script($context1, new \V8\StringValue($isolate1, $source1), new \V8\ScriptOrigin($file_name1));
5959

60-
// NOTE: this check is a bit fragile but should fits our need
61-
$needs_more_time = isset($_ENV['TRAVIS']) && isset($_ENV['TEST_PHP_ARGS']) && $_ENV['TEST_PHP_ARGS'] == '-m';
62-
63-
if ($needs_more_time) {
60+
if ($helper->need_more_time()) {
6461
// On travis when valgrind active it takes more time to complete all operations so we just increase initial limits
6562
$time_limit = 5.0;
6663
$low_range = 4.5;
67-
$high_range = 7.5;
64+
$high_range = 10.0;
6865
} else {
6966
$time_limit = 1.5;
7067
$low_range = 1.45;
71-
$high_range = 1.6;
68+
$high_range = 1.65;
7269
}
7370

7471
$isolate1->SetTimeLimit($time_limit);

tests/V8Isolate_limit_time_set_during_execution.phpt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,15 @@ $global_template1 = new V8\ObjectTemplate($isolate1);
1717

1818
$context1 = new V8\Context($isolate1, $extensions1, $global_template1);
1919

20-
// NOTE: this check is a bit fragile but should fits our need
21-
$needs_more_time = isset($_ENV['TRAVIS']) && isset($_ENV['TEST_PHP_ARGS']) && $_ENV['TEST_PHP_ARGS'] == '-m';
22-
23-
if ($needs_more_time) {
20+
if ($helper->need_more_time()) {
2421
// On travis when valgrind active it takes more time to complete all operations so we just increase initial limits
2522
$time_limit = 5.0;
2623
$low_range = 4.5;
27-
$high_range = 7.5;
24+
$high_range = 10.0;
2825
} else {
2926
$time_limit = 1.5;
3027
$low_range = 1.45;
31-
$high_range = 1.6;
28+
$high_range = 1.65;
3229
}
3330

3431
$func = new V8\FunctionObject($context1, function (\V8\FunctionCallbackInfo $info) use (&$helper, $time_limit) {

0 commit comments

Comments
 (0)