diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index ae07febb05..6d71c454d2 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -13,6 +13,7 @@ #include "cmsys/String.hxx" #include "cmsys/SystemInformation.hxx" #include +#include #include #include #include @@ -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) { diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 6ee56ed202..72a9d34458 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -15,6 +15,7 @@ #include "cmsys/RegularExpression.hxx" #include #include +#include #include #include #include @@ -32,7 +33,6 @@ cmCTestRunTest::cmCTestRunTest(cmCTestTestHandler* handler) this->ProcessOutput.clear(); this->CompressedOutput.clear(); this->CompressionRatio = 2; - this->StopTimePassed = false; this->NumberOfRunsLeft = 1; // default to 1 run of the test this->RunUntilFail = false; // default to run the test once this->RunAgain = false; // default to not having to run again @@ -524,15 +524,11 @@ bool cmCTestRunTest::StartTest(size_t total) std::chrono::system_clock::time_point stop_time = this->CTest->GetStopTime(); if (stop_time != std::chrono::system_clock::time_point()) { - auto stop_timeout = + std::chrono::duration stop_timeout = (stop_time - std::chrono::system_clock::now()) % std::chrono::hours(24); if (stop_timeout <= std::chrono::duration::zero()) { - cmCTestLog(this->CTest, ERROR_MESSAGE, "The stop time has been passed. " - "Stopping all tests." - << std::endl); - this->StopTimePassed = true; - return false; + stop_timeout = std::chrono::duration::zero(); } if (timeout == std::chrono::duration::zero() || stop_timeout < timeout) { diff --git a/Source/CTest/cmCTestRunTest.h b/Source/CTest/cmCTestRunTest.h index 136b9ef107..d5aa589cf2 100644 --- a/Source/CTest/cmCTestRunTest.h +++ b/Source/CTest/cmCTestRunTest.h @@ -50,8 +50,6 @@ public: std::string GetProcessOutput() { return this->ProcessOutput; } - bool IsStopTimePassed() { return this->StopTimePassed; } - cmCTestTestHandler::cmCTestTestResult GetTestResults() { return this->TestResult; @@ -108,7 +106,6 @@ private: std::string StartTime; std::string ActualCommand; std::vector Arguments; - bool StopTimePassed; bool RunUntilFail; int NumberOfRunsLeft; bool RunAgain;