本文整理汇总了PHP中ExecFuture::getWasKilledByTimeout方法的典型用法代码示例。如果您正苦于以下问题:PHP ExecFuture::getWasKilledByTimeout方法的具体用法?PHP ExecFuture::getWasKilledByTimeout怎么用?PHP ExecFuture::getWasKilledByTimeout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExecFuture
的用法示例。
在下文中一共展示了ExecFuture::getWasKilledByTimeout方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testTimeoutTestShouldRunLessThan1Sec
public function testTimeoutTestShouldRunLessThan1Sec()
{
// NOTE: This is partly testing that we choose appropriate select wait
// times; this test should run for significantly less than 1 second.
$future = new ExecFuture('sleep 32000');
list($err) = $future->setTimeout(0.01)->resolve();
$this->assertEqual(true, $err > 0);
$this->assertEqual(true, $future->getWasKilledByTimeout());
}
示例2: run
public function run()
{
$results = array();
$build_start = microtime(true);
$config_manager = $this->getConfigurationManager();
if ($this->getEnableCoverage() !== false) {
$command = $config_manager->getConfigFromAnySource('unit.engine.tap.cover');
} else {
$command = $config_manager->getConfigFromAnySource('unit.engine.tap.command');
}
$timeout = $config_manager->getConfigFromAnySource('unit.engine.tap.timeout');
if (!$timeout) {
$timeout = 15;
}
$future = new ExecFuture('%C', $command);
$future->setTimeout($timeout);
$result = new ArcanistUnitTestResult();
$result->setName($command ? $command : 'unknown');
try {
list($stdout, $stderr) = $future->resolvex();
$result->setResult(ArcanistUnitTestResult::RESULT_PASS);
if ($this->getEnableCoverage() !== false) {
$coverage = $this->readCoverage('coverage/cobertura-coverage.xml');
$result->setCoverage($coverage);
}
} catch (CommandException $exc) {
$result->setResult(ArcanistUnitTestResult::RESULT_FAIL);
if ($future->getWasKilledByTimeout()) {
print "Process stdout:\n" . $exc->getStdout() . "\nProcess stderr:\n" . $exc->getStderr() . "\nExceeded timeout of {$timeout} secs.\nMake unit tests faster.";
} else {
$result->setUserdata($exc->getStdout() . $exc->getStderr());
}
}
$result->setDuration(microtime(true) - $build_start);
$results[] = $result;
return $results;
}