diff --git a/tests/.testsuite.php b/tests/.testsuite.php index 496c865..e25466e 100644 --- a/tests/.testsuite.php +++ b/tests/.testsuite.php @@ -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 diff --git a/tests/V8Isolate_limit_time.phpt b/tests/V8Isolate_limit_time.phpt index d056d15..0cdcc71 100644 --- a/tests/V8Isolate_limit_time.phpt +++ b/tests/V8Isolate_limit_time.phpt @@ -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()); diff --git a/tests/V8Isolate_limit_time_nested.phpt b/tests/V8Isolate_limit_time_nested.phpt index 4eaea3d..32683a7 100644 --- a/tests/V8Isolate_limit_time_nested.phpt +++ b/tests/V8Isolate_limit_time_nested.phpt @@ -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); diff --git a/tests/V8Isolate_limit_time_set_during_execution.phpt b/tests/V8Isolate_limit_time_set_during_execution.phpt index e1ccd6b..00abfb5 100644 --- a/tests/V8Isolate_limit_time_set_during_execution.phpt +++ b/tests/V8Isolate_limit_time_set_during_execution.phpt @@ -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) {