From e279ba06dce9fa2eb6f2e7c7c8e1391d1681f9b2 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Mon, 21 Oct 2024 21:34:58 +0200 Subject: [PATCH] cmCTest: Inline InitializeTesting at its call site --- Source/cmCTest.cxx | 50 ++++++++++++++++++++++------------------------ Source/cmCTest.h | 5 ----- 2 files changed, 24 insertions(+), 31 deletions(-) diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index c15075c0ea..76684ba801 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -550,31 +550,6 @@ bool cmCTest::ReadExistingTag(bool quiet) return true; } -void cmCTest::InitializeTesting(const std::string& binary_dir) -{ - cmCTestLog(this, DEBUG, "Here: " << __LINE__ << std::endl); - if (!this->Impl->InteractiveDebugMode) { - this->BlockTestErrorDiagnostics(); - } else { - cmSystemTools::PutEnv("CTEST_INTERACTIVE_DEBUG_MODE=1"); - } - - this->Impl->BinaryDir = binary_dir; - cmSystemTools::ConvertToUnixSlashes(this->Impl->BinaryDir); - - this->UpdateCTestConfiguration(); - - cmCTestLog(this, DEBUG, "Here: " << __LINE__ << std::endl); - - cmake cm(cmake::RoleScript, cmState::CTest); - cm.SetHomeDirectory(""); - cm.SetHomeOutputDirectory(""); - cm.GetCurrentSnapshot().SetDefaultDefinitions(); - cmGlobalGenerator gg(&cm); - cmMakefile mf(&gg, cm.GetCurrentSnapshot()); - this->ReadCustomConfigurationFileTree(this->Impl->BinaryDir, &mf); -} - bool cmCTest::UpdateCTestConfiguration() { if (this->Impl->SuppressUpdatingCTestConfiguration) { @@ -2859,7 +2834,30 @@ int cmCTest::ExecuteTests() return 1; } - this->InitializeTesting(workDir); + cmCTestLog(this, DEBUG, "Here: " << __LINE__ << std::endl); + if (!this->Impl->InteractiveDebugMode) { + this->BlockTestErrorDiagnostics(); + } else { + cmSystemTools::PutEnv("CTEST_INTERACTIVE_DEBUG_MODE=1"); + } + + this->Impl->BinaryDir = workDir; + cmSystemTools::ConvertToUnixSlashes(this->Impl->BinaryDir); + + this->UpdateCTestConfiguration(); + + cmCTestLog(this, DEBUG, "Here: " << __LINE__ << std::endl); + + { + cmake cm(cmake::RoleScript, cmState::CTest); + cm.SetHomeDirectory(""); + cm.SetHomeOutputDirectory(""); + cm.GetCurrentSnapshot().SetDefaultDefinitions(); + cmGlobalGenerator gg(&cm); + cmMakefile mf(&gg, cm.GetCurrentSnapshot()); + this->ReadCustomConfigurationFileTree(this->Impl->BinaryDir, &mf); + } + this->GetTestHandler()->SetVerbose(this->Impl->Verbose); if (this->GetTestHandler()->ProcessHandler() < 0) { cmCTestLog(this, ERROR_MESSAGE, "Errors while running CTest\n"); diff --git a/Source/cmCTest.h b/Source/cmCTest.h index 633725c2dc..9ba887afa6 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -74,11 +74,6 @@ public: bool CreateNewTag(bool quiet); bool ReadExistingTag(bool quiet); - /** - * Initialize ctest for executing tests. - */ - void InitializeTesting(const std::string& binary_dir); - /** * Process the dashboard client steps. */