diff options
author | Brad King <brad.king@kitware.com> | 2017-12-08 12:04:36 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-12-08 12:14:05 (GMT) |
commit | e770b1b86e7157db4191096f226a8b0175819cff (patch) | |
tree | bc985a64e7c04879d046fe4aa99184f5e7ae4232 /Source/cmCTest.cxx | |
parent | be4702781d5bfe092daa2f6bfa1012c047e2161a (diff) | |
download | CMake-e770b1b86e7157db4191096f226a8b0175819cff.zip CMake-e770b1b86e7157db4191096f226a8b0175819cff.tar.gz CMake-e770b1b86e7157db4191096f226a8b0175819cff.tar.bz2 |
CTest: Fix regression in build-and-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/cmCTest.cxx')
-rw-r--r-- | Source/cmCTest.cxx | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index a4ca301..2cd60e5 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -1089,9 +1089,10 @@ int cmCTest::RunTest(std::vector<const char*> argv, std::string* output, bool modifyEnv = (environment && !environment->empty()); // determine how much time we have - std::chrono::duration<double> timeout = - std::min<std::chrono::duration<double>>(this->GetRemainingTimeAllowed(), - std::chrono::minutes(2)); + std::chrono::duration<double> timeout = this->GetRemainingTimeAllowed(); + if (timeout != std::chrono::duration<double>::max()) { + timeout -= std::chrono::minutes(2); + } if (this->TimeOut > std::chrono::duration<double>::zero() && this->TimeOut < timeout) { timeout = this->TimeOut; |