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.
This commit is contained in:
Ben Boeckel
2025-12-22 13:34:31 -05:00
parent a9c13c4144
commit c6940b0dcc
2 changed files with 3 additions and 0 deletions

View File

@@ -816,6 +816,7 @@ bool cmCTestRunTest::ForkProcess()
if (timeUntilStop < timeRemaining) {
timeRemaining = timeUntilStop;
}
this->TestProcess->SetStopTimeout(timeUntilStop);
}
// Enforce remaining time even over explicit TIMEOUT=0.

View File

@@ -37,6 +37,7 @@ public:
void SetCommand(std::string const& command);
void SetCommandArguments(std::vector<std::string> 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<cmDuration> StopTimeout;
cm::optional<cmDuration> Timeout;
TimeoutReason TimeoutReason_ = TimeoutReason::Normal;
std::chrono::steady_clock::time_point StartTime;