summaryrefslogtreecommitdiff
path: root/Source/CTest
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-12-07 07:14:38 -0500
committerBrad King <brad.king@kitware.com>2017-12-07 08:33:19 -0500
commitbe4702781d5bfe092daa2f6bfa1012c047e2161a (patch)
tree04a1341886022720a35ade3f323cc54a3fa6d1f1 /Source/CTest
parent66419bc04620c5748df77e2b563d65b0e97b623a (diff)
downloadcmake-be4702781d5bfe092daa2f6bfa1012c047e2161a.tar.gz
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.
Diffstat (limited to 'Source/CTest')
-rw-r--r--Source/CTest/cmCTestRunTest.cxx7
1 files changed, 4 insertions, 3 deletions
diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx
index 830ebdfb6b..a07564990a 100644
--- a/Source/CTest/cmCTestRunTest.cxx
+++ b/Source/CTest/cmCTestRunTest.cxx
@@ -18,7 +18,6 @@
#include "cmsys/Base64.h"
#include "cmsys/Process.h"
#include "cmsys/RegularExpression.hxx"
-#include <algorithm>
#include <chrono>
#include <iomanip>
#include <sstream>
@@ -686,8 +685,10 @@ bool cmCTestRunTest::ForkProcess(std::chrono::duration<double> testTimeOut,
// determine how much time we have
std::chrono::duration<double> timeout =
- std::min<std::chrono::duration<double>>(
- this->CTest->GetRemainingTimeAllowed(), std::chrono::minutes(2));
+ this->CTest->GetRemainingTimeAllowed();
+ if (timeout != std::chrono::duration<double>::max()) {
+ timeout -= std::chrono::minutes(2);
+ }
if (this->CTest->GetTimeOut() > std::chrono::duration<double>::zero() &&
this->CTest->GetTimeOut() < timeout) {
timeout = this->CTest->GetTimeOut();