Merge branch 'backport-ctest-timeout-report' into ctest-timeout-report

This commit is contained in:
Brad King
2020-03-26 14:42:17 -04:00
4 changed files with 16 additions and 10 deletions

View File

@@ -249,7 +249,7 @@ void cmProcess::OnRead(ssize_t nread, const uv_buf_t* buf)
this->PipeReader.reset(); this->PipeReader.reset();
if (this->ProcessHandleClosed) { if (this->ProcessHandleClosed) {
uv_timer_stop(this->Timer); uv_timer_stop(this->Timer);
this->Runner->FinalizeTest(); this->Finish();
} }
} }
@@ -291,7 +291,7 @@ void cmProcess::OnTimeout()
// Our on-exit handler already ran but did not finish the test // Our on-exit handler already ran but did not finish the test
// because we were still reading output. We've just dropped // because we were still reading output. We've just dropped
// our read handler, so we need to finish the test now. // our read handler, so we need to finish the test now.
this->Runner->FinalizeTest(); this->Finish();
} }
} }
@@ -321,6 +321,16 @@ void cmProcess::OnExit(int64_t exit_status, int term_signal)
// Record exit information. // Record exit information.
this->ExitValue = exit_status; this->ExitValue = exit_status;
this->Signal = term_signal; this->Signal = term_signal;
this->ProcessHandleClosed = true;
if (this->ReadHandleClosed) {
uv_timer_stop(this->Timer);
this->Finish();
}
}
void cmProcess::Finish()
{
this->TotalTime = std::chrono::steady_clock::now() - this->StartTime; this->TotalTime = std::chrono::steady_clock::now() - this->StartTime;
// Because of a processor clock scew the runtime may become slightly // Because of a processor clock scew the runtime may become slightly
// negative. If someone changed the system clock while the process was // negative. If someone changed the system clock while the process was
@@ -329,12 +339,7 @@ void cmProcess::OnExit(int64_t exit_status, int term_signal)
if (this->TotalTime <= cmDuration::zero()) { if (this->TotalTime <= cmDuration::zero()) {
this->TotalTime = cmDuration::zero(); this->TotalTime = cmDuration::zero();
} }
this->Runner->FinalizeTest();
this->ProcessHandleClosed = true;
if (this->ReadHandleClosed) {
uv_timer_stop(this->Timer);
this->Runner->FinalizeTest();
}
} }
cmProcess::State cmProcess::GetProcessStatus() cmProcess::State cmProcess::GetProcessStatus()

View File

@@ -108,6 +108,7 @@ private:
void OnAllocate(size_t suggested_size, uv_buf_t* buf); void OnAllocate(size_t suggested_size, uv_buf_t* buf);
void StartTimer(); void StartTimer();
void Finish();
class Buffer : public std::vector<char> class Buffer : public std::vector<char>
{ {

View File

@@ -1,6 +1,6 @@
Test project [^ Test project [^
]*/Tests/RunCMake/CTestTimeout/Basic-build ]*/Tests/RunCMake/CTestTimeout/Basic-build
Start 1: TestTimeout Start 1: TestTimeout
1/1 Test #1: TestTimeout ......................\*\*\*Timeout +[0-9.]+ sec 1/1 Test #1: TestTimeout ......................\*\*\*Timeout +[1-9][0-9.]* sec
+ +
0% tests passed, 1 tests failed out of 1 0% tests passed, 1 tests failed out of 1

View File

@@ -1,6 +1,6 @@
Test project [^ Test project [^
]*/Tests/RunCMake/CTestTimeout/Fork-build ]*/Tests/RunCMake/CTestTimeout/Fork-build
Start 1: TestTimeout Start 1: TestTimeout
1/1 Test #1: TestTimeout ......................\*\*\*Timeout +[0-9.]+ sec 1/1 Test #1: TestTimeout ......................\*\*\*Timeout +[1-9][0-9.]* sec
+ +
0% tests passed, 1 tests failed out of 1 0% tests passed, 1 tests failed out of 1