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

Commit

Permalink
Increase timeout upper limit to pass tests under valgrind
Browse files Browse the repository at this point in the history
  • Loading branch information
pinepain committed Aug 16, 2016
1 parent a9fbe2e commit 090ca9c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 18 deletions.
5 changes: 5 additions & 0 deletions tests/.testsuite.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,11 @@ public function dump_object_methods($object, array $arguments = [], FilterInterf
echo $rc->getName(), $info, $access, $m->getName(), '():', $final_res, PHP_EOL;
}
}

public function need_more_time() {
// NOTE: this check is a bit fragile but should fits our need
return isset($_ENV['TRAVIS']) && isset($_ENV['TEST_PHP_ARGS']) && $_ENV['TEST_PHP_ARGS'] == '-m';
}
}

interface FilterInterface
Expand Down
9 changes: 3 additions & 6 deletions tests/V8Isolate_limit_time.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,15 @@ $file_name = 'test.js';

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

// NOTE: this check is a bit fragile but should fits our need
$needs_more_time = isset($_ENV['TRAVIS']) && isset($_ENV['TEST_PHP_ARGS']) && $_ENV['TEST_PHP_ARGS'] == '-m';

if ($needs_more_time) {
if ($helper->need_more_time()) {
// On travis when valgrind active it takes more time to complete all operations so we just increase initial limits
$time_limit = 5.0;
$low_range = 4.5;
$high_range = 7.5;
$high_range = 10.0;
} else {
$time_limit = 1.5;
$low_range = 1.45;
$high_range = 1.6;
$high_range = 1.65;
}

$helper->assert('Time limit accessor report no hit', false === $isolate->IsTimeLimitHit());
Expand Down
9 changes: 3 additions & 6 deletions tests/V8Isolate_limit_time_nested.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,15 @@ $file_name1 = 'test.js';

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

// NOTE: this check is a bit fragile but should fits our need
$needs_more_time = isset($_ENV['TRAVIS']) && isset($_ENV['TEST_PHP_ARGS']) && $_ENV['TEST_PHP_ARGS'] == '-m';

if ($needs_more_time) {
if ($helper->need_more_time()) {
// On travis when valgrind active it takes more time to complete all operations so we just increase initial limits
$time_limit = 5.0;
$low_range = 4.5;
$high_range = 7.5;
$high_range = 10.0;
} else {
$time_limit = 1.5;
$low_range = 1.45;
$high_range = 1.6;
$high_range = 1.65;
}

$isolate1->SetTimeLimit($time_limit);
Expand Down
9 changes: 3 additions & 6 deletions tests/V8Isolate_limit_time_set_during_execution.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,15 @@ $global_template1 = new V8\ObjectTemplate($isolate1);

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

// NOTE: this check is a bit fragile but should fits our need
$needs_more_time = isset($_ENV['TRAVIS']) && isset($_ENV['TEST_PHP_ARGS']) && $_ENV['TEST_PHP_ARGS'] == '-m';

if ($needs_more_time) {
if ($helper->need_more_time()) {
// On travis when valgrind active it takes more time to complete all operations so we just increase initial limits
$time_limit = 5.0;
$low_range = 4.5;
$high_range = 7.5;
$high_range = 10.0;
} else {
$time_limit = 1.5;
$low_range = 1.45;
$high_range = 1.6;
$high_range = 1.65;
}

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

0 comments on commit 090ca9c

Please sign in to comment.