CTest: make sure never to report negative test times (#14132)
Because of clock scew between processors or just because of someone changing the system time the end timestamp may be before the start time. Reporting a negative time doesn't any sense, just report zero there as it already happens for really fast tests.
This commit is contained in:
parent
cf4869ba08
commit
e319e32b8c
|
@ -175,6 +175,14 @@ int cmProcess::GetNextOutputLine(std::string& line, double timeout)
|
||||||
// Record exit information.
|
// Record exit information.
|
||||||
this->ExitValue = cmsysProcess_GetExitValue(this->Process);
|
this->ExitValue = cmsysProcess_GetExitValue(this->Process);
|
||||||
this->TotalTime = cmSystemTools::GetTime() - this->StartTime;
|
this->TotalTime = cmSystemTools::GetTime() - this->StartTime;
|
||||||
|
// Because of a processor clock scew the runtime may become slightly
|
||||||
|
// negative. If someone changed the system clock while the process was
|
||||||
|
// running this may be even more. Make sure not to report a negative
|
||||||
|
// duration here.
|
||||||
|
if (this->TotalTime <= 0.0)
|
||||||
|
{
|
||||||
|
this->TotalTime = 0.0;
|
||||||
|
}
|
||||||
// std::cerr << "Time to run: " << this->TotalTime << "\n";
|
// std::cerr << "Time to run: " << this->TotalTime << "\n";
|
||||||
return cmsysProcess_Pipe_None;
|
return cmsysProcess_Pipe_None;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue