mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-28 18:09:42 -05:00
CTest: Fix regression in test timeout compuatation
Refactoring in commit 66419bc046 (CTest: convert timeouts to
std::chrono::duration, 2017-11-20) accidentally changed the logic used
to compute the timeout for a test when it starts. It incorrectly limits
the maximum possible timeout to 2 minutes rather than 2 minutes less
than the total allowed test time remaining. Update the new logic to
restore the original behavior.
Avoid subtracting 2 minutes from our "infinite" timeout value to avoid
creating very large timeouts that are not "infinite" and may exceed
integer type ranges.
This commit is contained in:
@@ -18,7 +18,6 @@
|
|||||||
#include "cmsys/Base64.h"
|
#include "cmsys/Base64.h"
|
||||||
#include "cmsys/Process.h"
|
#include "cmsys/Process.h"
|
||||||
#include "cmsys/RegularExpression.hxx"
|
#include "cmsys/RegularExpression.hxx"
|
||||||
#include <algorithm>
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
@@ -686,8 +685,10 @@ bool cmCTestRunTest::ForkProcess(std::chrono::duration<double> testTimeOut,
|
|||||||
|
|
||||||
// determine how much time we have
|
// determine how much time we have
|
||||||
std::chrono::duration<double> timeout =
|
std::chrono::duration<double> timeout =
|
||||||
std::min<std::chrono::duration<double>>(
|
this->CTest->GetRemainingTimeAllowed();
|
||||||
this->CTest->GetRemainingTimeAllowed(), std::chrono::minutes(2));
|
if (timeout != std::chrono::duration<double>::max()) {
|
||||||
|
timeout -= std::chrono::minutes(2);
|
||||||
|
}
|
||||||
if (this->CTest->GetTimeOut() > std::chrono::duration<double>::zero() &&
|
if (this->CTest->GetTimeOut() > std::chrono::duration<double>::zero() &&
|
||||||
this->CTest->GetTimeOut() < timeout) {
|
this->CTest->GetTimeOut() < timeout) {
|
||||||
timeout = this->CTest->GetTimeOut();
|
timeout = this->CTest->GetTimeOut();
|
||||||
|
|||||||
Reference in New Issue
Block a user