Open oruborus opened 10 months ago
Snippet for a first cut
// FIXME: Get this value from TestSuiteConfig or cli argument `--timeout`
$timeout = 10;
$start = \time();
$terminated = false;
while (proc_get_status($process)['running']) {
if (Fiber::getCurrent()) {
Fiber::suspend();
}
if(\time() - $start > $timeout) {
$terminated = true;
\proc_terminate($process);
fclose($pipes[1]);
fclose($pipes[2]);
// FIXME: Create this result using `TestResultFactory`
return new GenericTestResult(TestResultState::Skip, $testCase->path(), [], \time() - $start, new RuntimeException("Skipped for taking longer than {$timeout} seconds."));
}
}
Add an option to limit the runtime and mark test cases as timed out (T) after a certain interval