diff options
-rw-r--r-- | Source/CTest/cmCTestRunTest.cxx | 6 | ||||
-rw-r--r-- | Source/CTest/cmProcess.cxx | 10 | ||||
-rw-r--r-- | Source/CTest/cmProcess.h | 4 |
3 files changed, 11 insertions, 9 deletions
diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 307312d..46cb54e 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -770,7 +770,11 @@ bool cmCTestRunTest::ForkProcess(cmDuration testTimeOut) << "\n", this->TestHandler->GetQuiet()); - this->TestProcess->SetTimeout(timeout); + // An explicit TIMEOUT=0 test property means "no timeout". + if (timeout != cmDuration::zero() || + !this->TestProperties->ExplicitTimeout) { + this->TestProcess->SetTimeout(timeout); + } cmSystemTools::SaveRestoreEnvironment sre; std::ostringstream envMeasurement; diff --git a/Source/CTest/cmProcess.cxx b/Source/CTest/cmProcess.cxx index e14a4e1..780d626 100644 --- a/Source/CTest/cmProcess.cxx +++ b/Source/CTest/cmProcess.cxx @@ -13,7 +13,6 @@ #include "cmCTest.h" #include "cmCTestRunTest.h" -#include "cmCTestTestHandler.h" #include "cmGetPipes.h" #include "cmStringAlgorithms.h" #if defined(_WIN32) @@ -26,7 +25,6 @@ cmProcess::cmProcess(std::unique_ptr<cmCTestRunTest> runner) : Runner(std::move(runner)) , Conv(cmProcessOutput::UTF8, CM_PROCESS_BUF_SIZE) { - this->Timeout = cmDuration::zero(); this->TotalTime = cmDuration::zero(); this->ExitValue = 0; this->Id = 0; @@ -152,11 +150,9 @@ bool cmProcess::StartProcess(uv_loop_t& loop, std::vector<size_t>* affinity) void cmProcess::StartTimer() { - auto* properties = this->Runner->GetTestProperties(); - auto msec = - std::chrono::duration_cast<std::chrono::milliseconds>(this->Timeout); - - if (msec != std::chrono::milliseconds(0) || !properties->ExplicitTimeout) { + if (this->Timeout) { + auto msec = + std::chrono::duration_cast<std::chrono::milliseconds>(*this->Timeout); this->Timer.start(&cmProcess::OnTimeoutCB, static_cast<uint64_t>(msec.count()), 0); } diff --git a/Source/CTest/cmProcess.h b/Source/CTest/cmProcess.h index be030e4..1578687 100644 --- a/Source/CTest/cmProcess.h +++ b/Source/CTest/cmProcess.h @@ -12,6 +12,8 @@ #include <utility> #include <vector> +#include <cm/optional> + #include <cm3p/uv.h> #include "cmDuration.h" @@ -76,7 +78,7 @@ public: } private: - cmDuration Timeout; + cm::optional<cmDuration> Timeout; std::chrono::steady_clock::time_point StartTime; cmDuration TotalTime; bool ReadHandleClosed = false; |