MCPcopy Create free account
hub / github.com/Kitware/CMake / OnTimeout

Method OnTimeout

Source/CTest/cmProcess.cxx:285–324  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

283}
284
285void cmProcess::OnTimeout()
286{
287 bool const wasExecuting = this->ProcessState == cmProcess::State::Executing;
288 this->ProcessState = cmProcess::State::Expired;
289
290 // If the test process is still executing normally, and we timed out because
291 // the test timeout was reached, send the custom timeout signal, if any.
292 if (wasExecuting && this->TimeoutReason_ == TimeoutReason::Normal) {
293 cmCTestTestHandler::cmCTestTestProperties* p =
294 this->Runner->GetTestProperties();
295 if (p->TimeoutSignal) {
296 this->TerminationStyle = Termination::Custom;
297 uv_process_kill(this->Process, p->TimeoutSignal->Number);
298 if (p->TimeoutGracePeriod) {
299 this->Timeout = *p->TimeoutGracePeriod;
300 } else {
301 static cmDuration const defaultGracePeriod{ 1.0 };
302 this->Timeout = defaultGracePeriod;
303 }
304 this->StartTimer();
305 return;
306 }
307 }
308
309 this->TerminationStyle = Termination::Forced;
310 bool const was_still_reading = !this->ReadHandleClosed;
311 if (!this->ReadHandleClosed) {
312 this->ReadHandleClosed = true;
313 this->PipeReader.reset();
314 }
315 if (!this->ProcessHandleClosed) {
316 // Kill the child and let our on-exit handler finish the test.
317 cmsysProcess_KillPID(static_cast<unsigned long>(this->Process->pid));
318 } else if (was_still_reading) {
319 // Our on-exit handler already ran but did not finish the test
320 // because we were still reading output. We've just dropped
321 // our read handler, so we need to finish the test now.
322 this->Finish();
323 }
324}
325
326void cmProcess::OnExitCB(uv_process_t* process, int64_t exit_status,
327 int term_signal)

Callers 1

OnTimeoutCBMethod · 0.95

Calls 5

StartTimerMethod · 0.95
FinishMethod · 0.95
GetTestPropertiesMethod · 0.80
uv_process_killFunction · 0.50
resetMethod · 0.45

Tested by

no test coverage detected