diff options
author | Brad King <brad.king@kitware.com> | 2017-12-12 13:02:25 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2017-12-12 13:02:33 (GMT) |
commit | 1f5b2a8de93dc828d0cdc650478999133273c2c7 (patch) | |
tree | 7a0abc413deb20ee13a21065a7b6e0784d5fba41 /Source/CTest/cmCTestRunTest.cxx | |
parent | 62d8bff146b28c10c11ad7ef8114f8d06f2fcad8 (diff) | |
parent | ba6caafa42afb7fa2c7d8d0d49c73d79efee1e9c (diff) | |
download | CMake-1f5b2a8de93dc828d0cdc650478999133273c2c7.zip CMake-1f5b2a8de93dc828d0cdc650478999133273c2c7.tar.gz CMake-1f5b2a8de93dc828d0cdc650478999133273c2c7.tar.bz2 |
Merge topic 'fix-ctest-chrono'
ba6caafa CTest: Use integer-representable value for "infinite" timeout
548e8f6f CTest: Simplify std::chrono::duration<double> conversion to double
de0035fd cmCTestBuildAndTestHandler: Convert timeout to std::chrono::duration
687a26b7 CTest: Fix regression in build-and-test timeout forwarding
e770b1b8 CTest: Fix regression in build-and-test timeout compuatation
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: dublet <github@dublet.org>
Merge-request: !1574
Diffstat (limited to 'Source/CTest/cmCTestRunTest.cxx')
-rw-r--r-- | Source/CTest/cmCTestRunTest.cxx | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 7013db3..dbdefae 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -1,9 +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 that interfere. */ -#define NOMINMAX -#endif #include "cmCTestRunTest.h" #include "cmCTest.h" @@ -265,11 +261,7 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started) passed = this->TestResult.Status == cmCTestTestHandler::COMPLETED; char buf[1024]; - sprintf(buf, "%6.2f sec", - double(std::chrono::duration_cast<std::chrono::milliseconds>( - this->TestProcess->GetTotalTime()) - .count()) / - 1000.0); + sprintf(buf, "%6.2f sec", this->TestProcess->GetTotalTime().count()); cmCTestLog(this->CTest, HANDLER_OUTPUT, buf << "\n"); if (outputTestErrorsToConsole) { @@ -394,11 +386,7 @@ void cmCTestRunTest::ComputeWeightedCost() { double prev = static_cast<double>(this->TestProperties->PreviousRuns); double avgcost = static_cast<double>(this->TestProperties->Cost); - double current = - double(std::chrono::duration_cast<std::chrono::milliseconds>( - this->TestResult.ExecutionTime) - .count()) / - 1000.0; + double current = this->TestResult.ExecutionTime.count(); if (this->TestResult.Status == cmCTestTestHandler::COMPLETED) { this->TestProperties->Cost = @@ -690,7 +678,7 @@ bool cmCTestRunTest::ForkProcess(std::chrono::duration<double> testTimeOut, // determine how much time we have std::chrono::duration<double> timeout = this->CTest->GetRemainingTimeAllowed(); - if (timeout != std::chrono::duration<double>::max()) { + if (timeout != cmCTest::MaxDuration()) { timeout -= std::chrono::minutes(2); } if (this->CTest->GetTimeOut() > std::chrono::duration<double>::zero() && @@ -714,7 +702,7 @@ bool cmCTestRunTest::ForkProcess(std::chrono::duration<double> testTimeOut, this->CTest, HANDLER_VERBOSE_OUTPUT, this->Index << ": " << "Test timeout computed to be: " - << (timeout == std::chrono::duration<double>::max() + << (timeout == cmCTest::MaxDuration() ? std::string("infinite") : std::to_string( std::chrono::duration_cast<std::chrono::seconds>(timeout) |