From c6940b0dccef0bd29587b15604fdbe0ec95b1133 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 22 Dec 2025 13:34:31 -0500 Subject: cmProcess: explicitly track the StopTimeout When a test can have its timeout reset, the stop time still needs to be considered when setting the new timeout. Track it explicitly. --- Source/CTest/cmCTestRunTest.cxx | 1 + Source/CTest/cmProcess.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 24ee6eb..eff891a 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -816,6 +816,7 @@ bool cmCTestRunTest::ForkProcess() if (timeUntilStop < timeRemaining) { timeRemaining = timeUntilStop; } + this->TestProcess->SetStopTimeout(timeUntilStop); } // Enforce remaining time even over explicit TIMEOUT=0. diff --git a/Source/CTest/cmProcess.h b/Source/CTest/cmProcess.h index 2489ba5..d3df8d3 100644 --- a/Source/CTest/cmProcess.h +++ b/Source/CTest/cmProcess.h @@ -37,6 +37,7 @@ public: void SetCommand(std::string const& command); void SetCommandArguments(std::vector const& arg); void SetWorkingDirectory(std::string const& dir); + void SetStopTimeout(cmDuration t) { this->StopTimeout = t; } void SetTimeout(cmDuration t) { this->Timeout = t; } void ChangeTimeout(cmDuration t); void ResetStartTime(); @@ -104,6 +105,7 @@ public: Termination GetTerminationStyle() const { return this->TerminationStyle; } private: + cm::optional StopTimeout; cm::optional Timeout; TimeoutReason TimeoutReason_ = TimeoutReason::Normal; std::chrono::steady_clock::time_point StartTime; -- cgit v0.12