From 451429e19c235cb2200be1c7aba3f6b29f389857 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 1 Nov 2023 16:48:03 -0400 Subject: cmCTestMultiProcessHandler: Use cm::uv_loop_ptr abstraction This ensures all loop resources are released. --- Source/CTest/cmCTestMultiProcessHandler.cxx | 8 ++++---- Source/CTest/cmCTestMultiProcessHandler.h | 2 +- Source/CTest/cmCTestRunTest.cxx | 3 ++- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index d71a34d..c4e3759 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -142,10 +142,10 @@ void cmCTestMultiProcessHandler::RunTests() #endif this->TestHandler->SetMaxIndex(this->FindMaxIndex()); - uv_loop_init(&this->Loop); + this->Loop.init(); this->StartNextTests(); - uv_run(&this->Loop, UV_RUN_DEFAULT); - uv_loop_close(&this->Loop); + uv_run(this->Loop, UV_RUN_DEFAULT); + this->Loop.reset(); if (!this->StopTimePassed && !this->CheckStopOnFailure()) { assert(this->Complete()); @@ -618,7 +618,7 @@ void cmCTestMultiProcessHandler::StartNextTests() milliseconds = 10; } if (this->TestLoadRetryTimer.get() == nullptr) { - this->TestLoadRetryTimer.init(this->Loop, this); + this->TestLoadRetryTimer.init(*this->Loop, this); } this->TestLoadRetryTimer.start( &cmCTestMultiProcessHandler::OnTestLoadRetryCB, milliseconds, 0); diff --git a/Source/CTest/cmCTestMultiProcessHandler.h b/Source/CTest/cmCTestMultiProcessHandler.h index a002bcc..8c118a6 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.h +++ b/Source/CTest/cmCTestMultiProcessHandler.h @@ -201,7 +201,7 @@ protected: size_t ParallelLevel; // max number of process that can be run at once unsigned long TestLoad; unsigned long FakeLoadForTesting; - uv_loop_t Loop; + cm::uv_loop_ptr Loop; cm::uv_timer_ptr TestLoadRetryTimer; cmCTestTestHandler* TestHandler; cmCTest* CTest; diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index d6b6d41..4b97365 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -25,6 +25,7 @@ #include "cmProcess.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" +#include "cmUVHandlePtr.h" #include "cmWorkingDirectory.h" cmCTestRunTest::cmCTestRunTest(cmCTestMultiProcessHandler& multiHandler, @@ -890,7 +891,7 @@ bool cmCTestRunTest::ForkProcess() this->TestResult.Environment.erase(this->TestResult.Environment.length() - 1); - return this->TestProcess->StartProcess(this->MultiTestHandler.Loop, + return this->TestProcess->StartProcess(*this->MultiTestHandler.Loop, &this->TestProperties->Affinity); } -- cgit v0.12