Skip to content

Commit

Permalink
Made a few updates to re-wire the timeout value from the command line…
Browse files Browse the repository at this point in the history
… into the Job script generator
  • Loading branch information
Pádraic Brady committed Jan 30, 2012
1 parent ea560aa commit 89716eb
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
17 changes: 11 additions & 6 deletions library/Mutagenesis/Adapter/Phpunit.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ public function runTests(\Mutagenesis\Runner\Base $runner, $useStdout = true,
$job->generate(
$mutation,
$args,
$runner->getTimeout(),
$runner->getBootstrap()
),
$runner->getTimeout()
)
);
if (!$this->processOutput($output['stdout'])) {
return array(false, $output);
Expand All @@ -85,9 +85,14 @@ public function runTests(\Mutagenesis\Runner\Base $runner, $useStdout = true,
$job->generate(
$mutation,
$options,
/**
* We don't want the initial test run to time out because it
* executes all tests in a single process for PHPUnit (though
* PHPUnit may use parallel processes internally).
*/
0,
$runner->getBootstrap()
),
$runner->getTimeout()
)
);
if (!$this->processOutput($output['stdout'])) {
return array(false, $output);
Expand All @@ -102,9 +107,9 @@ public function runTests(\Mutagenesis\Runner\Base $runner, $useStdout = true,
* @param string $jobScript
* @return string $output
*/
public static function execute($jobScript, $timeout = 120)
public static function execute($jobScript)
{
$output = \Mutagenesis\Utility\Process::run($jobScript, $timeout);
$output = \Mutagenesis\Utility\Process::run($jobScript);
return $output;
}

Expand Down
4 changes: 2 additions & 2 deletions library/Mutagenesis/Runner/RunnerAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,11 @@ abstract class RunnerAbstract
protected $_options = array();

/**
* Timeout in seconds allowed per test execution
* Timeout in seconds allowed per test execution.
*
* @var int
*/
protected $_timeout = 120;
protected $_timeout = 60;

/**
* Test framework bootstrap
Expand Down
4 changes: 2 additions & 2 deletions library/Mutagenesis/Utility/Job.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Job
* @param array $mutation Mutation data and objects to be used
* @return string
*/
public function generate(array $mutation = array(), array $args = array(), $bootstrap = null)
public function generate(array $mutation = array(), array $args = array(), $timeout = 60, $bootstrap = null)
{
$serializedArgs = addslashes(serialize($args));
$serializedMutation = addslashes(serialize($mutation));
Expand Down Expand Up @@ -60,7 +60,7 @@ static function timeout() {
}
}
pcntl_signal(SIGALRM, array('\\MutagenesisEnv\\Job', 'timeout'), TRUE);
pcntl_alarm(120);
pcntl_alarm({$timeout});
try {
Job::main();
} catch (\\Exception \$e) {
Expand Down
2 changes: 1 addition & 1 deletion tests/Mutagenesis/Utility/JobTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ static function timeout() {
}
}
pcntl_signal(SIGALRM, array('\\MutagenesisEnv\\Job', 'timeout'), TRUE);
pcntl_alarm(120);
pcntl_alarm(60);
try {
Job::main();
} catch (\\Exception \$e) {
Expand Down

0 comments on commit 89716eb

Please sign in to comment.