summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-12-15 13:24:24 (GMT)
committerBrad King <brad.king@kitware.com>2018-01-08 17:55:01 (GMT)
commit4c199a4c28a0647c0277c7009b5f6e81b26333bb (patch)
tree96ee0fb079b8177e50e5737e37a0bfc7b7123aab
parent2567e5df69c1a4276c5e51dfa6c49482b24b1545 (diff)
downloadCMake-4c199a4c28a0647c0277c7009b5f6e81b26333bb.zip
CMake-4c199a4c28a0647c0277c7009b5f6e81b26333bb.tar.gz
CMake-4c199a4c28a0647c0277c7009b5f6e81b26333bb.tar.bz2
cmCTestRunTest: Subsume ResolveTimeout into only call site
-rw-r--r--Source/CTest/cmCTestRunTest.cxx45
-rw-r--r--Source/CTest/cmCTestRunTest.h2
2 files changed, 18 insertions, 29 deletions
diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx
index 8050b9a..6ee56ed 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)
diff --git a/Source/CTest/cmCTestRunTest.h b/Source/CTest/cmCTestRunTest.h
index cd380ca..136b9ef 100644
--- a/Source/CTest/cmCTestRunTest.h
+++ b/Source/CTest/cmCTestRunTest.h
@@ -78,8 +78,6 @@ private:
bool NeedsToRerun();
void DartProcessing();
void ExeNotFound(std::string exe);
- // Figures out a final timeout which is min(STOP_TIME, NOW+TIMEOUT)
- std::chrono::duration<double> ResolveTimeout();
bool ForkProcess(std::chrono::duration<double> testTimeOut,
bool explicitTimeout,
std::vector<std::string>* environment);