mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-02 20:29:49 -05:00
CTest: Use integer-representable value for "infinite" timeout
Refactoring in commit 66419bc046 (CTest: convert timeouts to
std::chrono::duration, 2017-11-20) changed out "infinite" timeout to a
value not representable by a 64-bit integer. This causes undefined
behavior when e.g. KWSys Process converts the duration to a `long` to
interact with system APIs. Use the old `1.0e7` maximum value.
This commit is contained in:
@@ -1,12 +1,5 @@
|
||||
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
file Copyright.txt or https://cmake.org/licensing for details. */
|
||||
|
||||
#ifdef _WIN32
|
||||
/* windows.h defines min() and max() macros, unless told to otherwise. This
|
||||
* interferes with std::min() and std::max() at the very least. */
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
|
||||
#include "cmCTestScriptHandler.h"
|
||||
|
||||
#include "cmsys/Directory.hxx"
|
||||
@@ -970,13 +963,13 @@ bool cmCTestScriptHandler::TryToRemoveBinaryDirectoryOnce(
|
||||
std::chrono::duration<double> cmCTestScriptHandler::GetRemainingTimeAllowed()
|
||||
{
|
||||
if (!this->Makefile) {
|
||||
return std::chrono::duration<double>::max();
|
||||
return cmCTest::MaxDuration();
|
||||
}
|
||||
|
||||
const char* timelimitS = this->Makefile->GetDefinition("CTEST_TIME_LIMIT");
|
||||
|
||||
if (!timelimitS) {
|
||||
return std::chrono::duration<double>::max();
|
||||
return cmCTest::MaxDuration();
|
||||
}
|
||||
|
||||
auto timelimit = std::chrono::duration<double>(atof(timelimitS));
|
||||
|
||||
Reference in New Issue
Block a user