diff options
author | Brad King <brad.king@kitware.com> | 2017-12-15 08:24:24 -0500 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-01-08 12:55:01 -0500 |
commit | 4c199a4c28a0647c0277c7009b5f6e81b26333bb (patch) | |
tree | 96ee0fb079b8177e50e5737e37a0bfc7b7123aab /Source/CTest/cmCTestRunTest.cxx | |
parent | 2567e5df69c1a4276c5e51dfa6c49482b24b1545 (diff) | |
download | cmake-4c199a4c28a0647c0277c7009b5f6e81b26333bb.tar.gz |
cmCTestRunTest: Subsume ResolveTimeout into only call site
Diffstat (limited to 'Source/CTest/cmCTestRunTest.cxx')
-rw-r--r-- | Source/CTest/cmCTestRunTest.cxx | 45 |
1 files changed, 18 insertions, 27 deletions
diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 8050b9afe4..6ee56ed202 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -520,11 +520,26 @@ bool cmCTestRunTest::StartTest(size_t total) } this->StartTime = this->CTest->CurrentTime(); - auto timeout = this->ResolveTimeout(); + auto timeout = this->TestProperties->Timeout; - if (this->StopTimePassed) { - return false; + std::chrono::system_clock::time_point stop_time = this->CTest->GetStopTime(); + if (stop_time != std::chrono::system_clock::time_point()) { + auto stop_timeout = + (stop_time - std::chrono::system_clock::now()) % std::chrono::hours(24); + + if (stop_timeout <= std::chrono::duration<double>::zero()) { + cmCTestLog(this->CTest, ERROR_MESSAGE, "The stop time has been passed. " + "Stopping all tests." + << std::endl); + this->StopTimePassed = true; + return false; + } + if (timeout == std::chrono::duration<double>::zero() || + stop_timeout < timeout) { + timeout = stop_timeout; + } } + return this->ForkProcess(timeout, this->TestProperties->ExplicitTimeout, &this->TestProperties->Environment); } @@ -601,30 +616,6 @@ void cmCTestRunTest::DartProcessing() } } -std::chrono::duration<double> cmCTestRunTest::ResolveTimeout() -{ - auto timeout = this->TestProperties->Timeout; - - std::chrono::system_clock::time_point stop_time = this->CTest->GetStopTime(); - if (stop_time == std::chrono::system_clock::time_point()) { - return timeout; - } - - auto stop_timeout = - (stop_time - std::chrono::system_clock::now()) % std::chrono::hours(24); - - if (stop_timeout <= std::chrono::duration<double>::zero()) { - cmCTestLog(this->CTest, ERROR_MESSAGE, "The stop time has been passed. " - "Stopping all tests." - << std::endl); - this->StopTimePassed = true; - return std::chrono::duration<double>::zero(); - } - return timeout == std::chrono::duration<double>::zero() - ? stop_timeout - : (timeout < stop_timeout ? timeout : stop_timeout); -} - bool cmCTestRunTest::ForkProcess(std::chrono::duration<double> testTimeOut, bool explicitTimeout, std::vector<std::string>* environment) |