summaryrefslogtreecommitdiff
path: root/Source/CTest/cmCTestRunTest.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-12-15 08:24:24 -0500
committerBrad King <brad.king@kitware.com>2018-01-08 12:55:01 -0500
commit4c199a4c28a0647c0277c7009b5f6e81b26333bb (patch)
tree96ee0fb079b8177e50e5737e37a0bfc7b7123aab /Source/CTest/cmCTestRunTest.cxx
parent2567e5df69c1a4276c5e51dfa6c49482b24b1545 (diff)
downloadcmake-4c199a4c28a0647c0277c7009b5f6e81b26333bb.tar.gz
cmCTestRunTest: Subsume ResolveTimeout into only call site
Diffstat (limited to 'Source/CTest/cmCTestRunTest.cxx')
-rw-r--r--Source/CTest/cmCTestRunTest.cxx45
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)