summaryrefslogtreecommitdiffstats
path: root/Source/CTest/cmCTestMultiProcessHandler.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-12-15 13:36:16 (GMT)
committerBrad King <brad.king@kitware.com>2018-01-08 17:55:01 (GMT)
commit61ab5a8ef451484d3014118ed193eeba83bb22a4 (patch)
treecab8c9b0d7b3ba423128f9f06fb7cd73f4b614e0 /Source/CTest/cmCTestMultiProcessHandler.cxx
parent4c199a4c28a0647c0277c7009b5f6e81b26333bb (diff)
downloadCMake-61ab5a8ef451484d3014118ed193eeba83bb22a4.zip
CMake-61ab5a8ef451484d3014118ed193eeba83bb22a4.tar.gz
CMake-61ab5a8ef451484d3014118ed193eeba83bb22a4.tar.bz2
cmCTestMultiProcessHandler: Check stop time more directly
Avoid creating a cmCTestRunTest instance if the stop time has been reached. If the stop time occurs in the small time between creating an instance and computing the child process timeout, we will simply compute a zero timeout. This is already done for the case that we StartAgain after the stop time.
Diffstat (limited to 'Source/CTest/cmCTestMultiProcessHandler.cxx')
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.cxx15
1 files changed, 11 insertions, 4 deletions
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx
index ae07feb..6d71c45 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.cxx
+++ b/Source/CTest/cmCTestMultiProcessHandler.cxx
@@ -13,6 +13,7 @@
#include "cmsys/String.hxx"
#include "cmsys/SystemInformation.hxx"
#include <algorithm>
+#include <chrono>
#include <iomanip>
#include <list>
#include <math.h>
@@ -113,6 +114,16 @@ void cmCTestMultiProcessHandler::RunTests()
void cmCTestMultiProcessHandler::StartTestProcess(int test)
{
+ std::chrono::system_clock::time_point stop_time = this->CTest->GetStopTime();
+ if (stop_time != std::chrono::system_clock::time_point() &&
+ stop_time <= std::chrono::system_clock::now()) {
+ cmCTestLog(this->CTest, ERROR_MESSAGE, "The stop time has been passed. "
+ "Stopping all tests."
+ << std::endl);
+ this->StopTimePassed = true;
+ return;
+ }
+
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"test " << test << "\n", this->Quiet);
this->TestRunningMap[test] = true; // mark the test as running
@@ -144,10 +155,6 @@ void cmCTestMultiProcessHandler::StartTestProcess(int test)
if (testRun->StartTest(this->Total)) {
this->RunningTests.insert(testRun);
- } else if (testRun->IsStopTimePassed()) {
- this->StopTimePassed = true;
- delete testRun;
- return;
} else {
for (auto& j : this->Tests) {