diff --git a/Source/CTest/cmCTestBuildCommand.cxx b/Source/CTest/cmCTestBuildCommand.cxx index c95f4e5db4..160f3d6122 100644 --- a/Source/CTest/cmCTestBuildCommand.cxx +++ b/Source/CTest/cmCTestBuildCommand.cxx @@ -13,6 +13,7 @@ #include "cmCTestBuildHandler.h" #include "cmCTestGenericHandler.h" #include "cmCommand.h" +#include "cmExecutionStatus.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" #include "cmMessageType.h" @@ -21,8 +22,6 @@ #include "cmValue.h" #include "cmake.h" -class cmExecutionStatus; - std::unique_ptr cmCTestBuildCommand::Clone() { auto ni = cm::make_unique(); @@ -49,9 +48,9 @@ bool cmCTestBuildCommand::InitialPass(std::vector const& args, } std::unique_ptr cmCTestBuildCommand::InitializeHandler( - HandlerArguments& arguments) + HandlerArguments& arguments, cmExecutionStatus& status) { - cmMakefile& mf = *this->Makefile; + cmMakefile& mf = status.GetMakefile(); auto const& args = static_cast(arguments); auto handler = cm::make_unique(this->CTest); @@ -116,7 +115,7 @@ std::unique_ptr cmCTestBuildCommand::InitializeHandler( "is set. Otherwise, set CTEST_BUILD_COMMAND to build the project " "with a custom command line."; /* clang-format on */ - this->SetError(ostr.str()); + status.SetError(ostr.str()); return nullptr; } } @@ -137,9 +136,10 @@ std::unique_ptr cmCTestBuildCommand::InitializeHandler( } void cmCTestBuildCommand::ProcessAdditionalValues( - cmCTestGenericHandler* generic, HandlerArguments const& arguments) + cmCTestGenericHandler* generic, HandlerArguments const& arguments, + cmExecutionStatus& status) { - cmMakefile& mf = *this->Makefile; + cmMakefile& mf = status.GetMakefile(); auto const& args = static_cast(arguments); auto const* handler = static_cast(generic); if (!args.NumberErrors.empty()) { diff --git a/Source/CTest/cmCTestBuildCommand.h b/Source/CTest/cmCTestBuildCommand.h index b6a873bd44..23eb48a8f5 100644 --- a/Source/CTest/cmCTestBuildCommand.h +++ b/Source/CTest/cmCTestBuildCommand.h @@ -37,10 +37,11 @@ private: std::string GetName() const override { return "ctest_build"; } std::unique_ptr InitializeHandler( - HandlerArguments& arguments) override; + HandlerArguments& arguments, cmExecutionStatus& status) override; void ProcessAdditionalValues(cmCTestGenericHandler* handler, - HandlerArguments const& arguments) override; + HandlerArguments const& arguments, + cmExecutionStatus& status) override; bool InitialPass(std::vector const& args, cmExecutionStatus& status) override; diff --git a/Source/CTest/cmCTestConfigureCommand.cxx b/Source/CTest/cmCTestConfigureCommand.cxx index b3f33351f3..b4fc1edae2 100644 --- a/Source/CTest/cmCTestConfigureCommand.cxx +++ b/Source/CTest/cmCTestConfigureCommand.cxx @@ -15,6 +15,7 @@ #include "cmCTestConfigureHandler.h" #include "cmCTestGenericHandler.h" #include "cmCommand.h" +#include "cmExecutionStatus.h" #include "cmGlobalGenerator.h" #include "cmList.h" #include "cmMakefile.h" @@ -31,9 +32,10 @@ std::unique_ptr cmCTestConfigureCommand::Clone() } std::unique_ptr -cmCTestConfigureCommand::InitializeHandler(HandlerArguments& arguments) +cmCTestConfigureCommand::InitializeHandler(HandlerArguments& arguments, + cmExecutionStatus& status) { - cmMakefile& mf = *this->Makefile; + cmMakefile& mf = status.GetMakefile(); auto const& args = static_cast(arguments); cmList options; @@ -42,7 +44,7 @@ cmCTestConfigureCommand::InitializeHandler(HandlerArguments& arguments) } if (this->CTest->GetCTestConfiguration("BuildDirectory").empty()) { - this->SetError( + status.SetError( "Build directory not specified. Either use BUILD " "argument to CTEST_CONFIGURE command or set CTEST_BINARY_DIRECTORY " "variable"); @@ -60,7 +62,7 @@ cmCTestConfigureCommand::InitializeHandler(HandlerArguments& arguments) const std::string& source_dir = this->CTest->GetCTestConfiguration("SourceDirectory"); if (source_dir.empty()) { - this->SetError( + status.SetError( "Source directory not specified. Either use SOURCE " "argument to CTEST_CONFIGURE command or set CTEST_SOURCE_DIRECTORY " "variable"); @@ -71,7 +73,7 @@ cmCTestConfigureCommand::InitializeHandler(HandlerArguments& arguments) if (!cmSystemTools::FileExists(cmakelists_file)) { std::ostringstream e; e << "CMakeLists.txt file does not exist [" << cmakelists_file << "]"; - this->SetError(e.str()); + status.SetError(e.str()); return nullptr; } @@ -142,7 +144,7 @@ cmCTestConfigureCommand::InitializeHandler(HandlerArguments& arguments) this->CTest->SetCTestConfiguration("ConfigureCommand", cmakeConfigureCommand, args.Quiet); } else { - this->SetError( + status.SetError( "Configure command is not specified. If this is a " "\"built with CMake\" project, set CTEST_CMAKE_GENERATOR. If not, " "set CTEST_CONFIGURE_COMMAND."); diff --git a/Source/CTest/cmCTestConfigureCommand.h b/Source/CTest/cmCTestConfigureCommand.h index a14f44a8ea..eae5d8caf8 100644 --- a/Source/CTest/cmCTestConfigureCommand.h +++ b/Source/CTest/cmCTestConfigureCommand.h @@ -31,7 +31,7 @@ private: std::string GetName() const override { return "ctest_configure"; } std::unique_ptr InitializeHandler( - HandlerArguments& arguments) override; + HandlerArguments& arguments, cmExecutionStatus& status) override; bool InitialPass(std::vector const& args, cmExecutionStatus& status) override; diff --git a/Source/CTest/cmCTestCoverageCommand.cxx b/Source/CTest/cmCTestCoverageCommand.cxx index a91a9938fb..5443b12d8c 100644 --- a/Source/CTest/cmCTestCoverageCommand.cxx +++ b/Source/CTest/cmCTestCoverageCommand.cxx @@ -13,6 +13,7 @@ #include "cmCTestCoverageHandler.h" #include "cmCTestGenericHandler.h" #include "cmCommand.h" +#include "cmExecutionStatus.h" class cmMakefile; @@ -24,9 +25,10 @@ std::unique_ptr cmCTestCoverageCommand::Clone() } std::unique_ptr -cmCTestCoverageCommand::InitializeHandler(HandlerArguments& arguments) +cmCTestCoverageCommand::InitializeHandler(HandlerArguments& arguments, + cmExecutionStatus& status) { - cmMakefile& mf = *this->Makefile; + cmMakefile& mf = status.GetMakefile(); auto& args = static_cast(arguments); this->CTest->SetCTestConfigurationFromCMakeVariable( &mf, "CoverageCommand", "CTEST_COVERAGE_COMMAND", args.Quiet); diff --git a/Source/CTest/cmCTestCoverageCommand.h b/Source/CTest/cmCTestCoverageCommand.h index b193a6440d..d3ad3acdca 100644 --- a/Source/CTest/cmCTestCoverageCommand.h +++ b/Source/CTest/cmCTestCoverageCommand.h @@ -34,7 +34,7 @@ private: std::string GetName() const override { return "ctest_coverage"; } std::unique_ptr InitializeHandler( - HandlerArguments& arguments) override; + HandlerArguments& arguments, cmExecutionStatus& status) override; bool InitialPass(std::vector const& args, cmExecutionStatus& status) override; diff --git a/Source/CTest/cmCTestHandlerCommand.cxx b/Source/CTest/cmCTestHandlerCommand.cxx index 30843141fa..f8eb238af2 100644 --- a/Source/CTest/cmCTestHandlerCommand.cxx +++ b/Source/CTest/cmCTestHandlerCommand.cxx @@ -122,7 +122,7 @@ bool cmCTestHandlerCommand::ExecuteHandlerCommand(HandlerArguments& args, cmMakefile& mf = status.GetMakefile(); // Process input arguments. - this->CheckArguments(args); + this->CheckArguments(args, status); // Set the config type of this ctest to the current value of the // CTEST_CONFIGURATION_TYPE script variable if it is defined. @@ -166,7 +166,7 @@ bool cmCTestHandlerCommand::ExecuteHandlerCommand(HandlerArguments& args, } cmCTestLog(this->CTest, DEBUG, "Initialize handler" << std::endl); - auto handler = this->InitializeHandler(args); + auto handler = this->InitializeHandler(args, status); if (!handler) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot instantiate test handler " << this->GetName() @@ -183,7 +183,7 @@ bool cmCTestHandlerCommand::ExecuteHandlerCommand(HandlerArguments& args, cmWorkingDirectory workdir( this->CTest->GetCTestConfiguration("BuildDirectory")); if (workdir.Failed()) { - this->SetError(workdir.GetError()); + status.SetError(workdir.GetError()); return false; } @@ -195,21 +195,23 @@ bool cmCTestHandlerCommand::ExecuteHandlerCommand(HandlerArguments& args, if (!args.ReturnValue.empty()) { mf.AddDefinition(args.ReturnValue, std::to_string(res)); } - this->ProcessAdditionalValues(handler.get(), args); + this->ProcessAdditionalValues(handler.get(), args, status); return true; } -void cmCTestHandlerCommand::CheckArguments(HandlerArguments&) +void cmCTestHandlerCommand::CheckArguments(HandlerArguments&, + cmExecutionStatus&) { } std::unique_ptr -cmCTestHandlerCommand::InitializeHandler(HandlerArguments&) +cmCTestHandlerCommand::InitializeHandler(HandlerArguments&, cmExecutionStatus&) { return nullptr; }; void cmCTestHandlerCommand::ProcessAdditionalValues(cmCTestGenericHandler*, - HandlerArguments const&) + HandlerArguments const&, + cmExecutionStatus&) { } diff --git a/Source/CTest/cmCTestHandlerCommand.h b/Source/CTest/cmCTestHandlerCommand.h index 1a863c3adc..fcf9c07bad 100644 --- a/Source/CTest/cmCTestHandlerCommand.h +++ b/Source/CTest/cmCTestHandlerCommand.h @@ -85,11 +85,13 @@ private: virtual std::string GetName() const = 0; - virtual void CheckArguments(HandlerArguments& arguments); + virtual void CheckArguments(HandlerArguments& arguments, + cmExecutionStatus& status); virtual std::unique_ptr InitializeHandler( - HandlerArguments& arguments); + HandlerArguments& arguments, cmExecutionStatus& status); virtual void ProcessAdditionalValues(cmCTestGenericHandler*, - HandlerArguments const& arguments); + HandlerArguments const& arguments, + cmExecutionStatus& status); }; diff --git a/Source/CTest/cmCTestMemCheckCommand.cxx b/Source/CTest/cmCTestMemCheckCommand.cxx index 99915b110c..bf8d046bc0 100644 --- a/Source/CTest/cmCTestMemCheckCommand.cxx +++ b/Source/CTest/cmCTestMemCheckCommand.cxx @@ -12,6 +12,7 @@ #include "cmCTestMemCheckHandler.h" #include "cmCTestTestHandler.h" #include "cmCommand.h" +#include "cmExecutionStatus.h" #include "cmMakefile.h" std::unique_ptr cmCTestMemCheckCommand::Clone() @@ -22,9 +23,10 @@ std::unique_ptr cmCTestMemCheckCommand::Clone() } std::unique_ptr -cmCTestMemCheckCommand::InitializeActualHandler(HandlerArguments& args) +cmCTestMemCheckCommand::InitializeActualHandler(HandlerArguments& args, + cmExecutionStatus& status) { - cmMakefile& mf = *this->Makefile; + cmMakefile& mf = status.GetMakefile(); auto handler = cm::make_unique(this->CTest); this->CTest->SetCTestConfigurationFromCMakeVariable( @@ -46,9 +48,10 @@ cmCTestMemCheckCommand::InitializeActualHandler(HandlerArguments& args) } void cmCTestMemCheckCommand::ProcessAdditionalValues( - cmCTestGenericHandler* handler, HandlerArguments const& arguments) + cmCTestGenericHandler* handler, HandlerArguments const& arguments, + cmExecutionStatus& status) { - cmMakefile& mf = *this->Makefile; + cmMakefile& mf = status.GetMakefile(); auto const& args = static_cast(arguments); if (!args.DefectCount.empty()) { mf.AddDefinition( diff --git a/Source/CTest/cmCTestMemCheckCommand.h b/Source/CTest/cmCTestMemCheckCommand.h index 53a5d0b958..4993403b7e 100644 --- a/Source/CTest/cmCTestMemCheckCommand.h +++ b/Source/CTest/cmCTestMemCheckCommand.h @@ -32,10 +32,11 @@ private: std::string GetName() const override { return "ctest_memcheck"; } std::unique_ptr InitializeActualHandler( - HandlerArguments& arguments) override; + HandlerArguments& arguments, cmExecutionStatus& status) override; void ProcessAdditionalValues(cmCTestGenericHandler* handler, - HandlerArguments const& arguments) override; + HandlerArguments const& arguments, + cmExecutionStatus& status) override; bool InitialPass(std::vector const& args, cmExecutionStatus& status) override; diff --git a/Source/CTest/cmCTestReadCustomFilesCommand.cxx b/Source/CTest/cmCTestReadCustomFilesCommand.cxx index a25cca49c8..6075f9bc95 100644 --- a/Source/CTest/cmCTestReadCustomFilesCommand.cxx +++ b/Source/CTest/cmCTestReadCustomFilesCommand.cxx @@ -3,19 +3,21 @@ #include "cmCTestReadCustomFilesCommand.h" #include "cmCTest.h" +#include "cmExecutionStatus.h" -class cmExecutionStatus; +class cmMakefile; bool cmCTestReadCustomFilesCommand::InitialPass( - std::vector const& args, cmExecutionStatus& /*unused*/) + std::vector const& args, cmExecutionStatus& status) { if (args.empty()) { - this->SetError("called with incorrect number of arguments"); + status.SetError("called with incorrect number of arguments"); return false; } + cmMakefile& mf = status.GetMakefile(); for (std::string const& arg : args) { - this->CTest->ReadCustomConfigurationFileTree(arg, this->Makefile); + this->CTest->ReadCustomConfigurationFileTree(arg, &mf); } return true; diff --git a/Source/CTest/cmCTestRunScriptCommand.cxx b/Source/CTest/cmCTestRunScriptCommand.cxx index 38953eab05..179fac4c72 100644 --- a/Source/CTest/cmCTestRunScriptCommand.cxx +++ b/Source/CTest/cmCTestRunScriptCommand.cxx @@ -15,6 +15,7 @@ bool cmCTestRunScriptCommand::InitialPass(std::vector const& args, return false; } + cmMakefile& mf = status.GetMakefile(); bool np = false; unsigned int i = 0; if (args[i] == "NEW_PROCESS") { @@ -37,10 +38,9 @@ bool cmCTestRunScriptCommand::InitialPass(std::vector const& args, ++i; } else { int ret; - cmCTestScriptHandler::RunScript(this->CTest, this->Makefile, - cmSystemTools::CollapseFullPath(args[i]), - !np, &ret); - this->Makefile->AddDefinition(returnVariable, std::to_string(ret)); + cmCTestScriptHandler::RunScript( + this->CTest, &mf, cmSystemTools::CollapseFullPath(args[i]), !np, &ret); + mf.AddDefinition(returnVariable, std::to_string(ret)); } } return true; diff --git a/Source/CTest/cmCTestStartCommand.cxx b/Source/CTest/cmCTestStartCommand.cxx index 03d03bf31e..71912e1831 100644 --- a/Source/CTest/cmCTestStartCommand.cxx +++ b/Source/CTest/cmCTestStartCommand.cxx @@ -7,19 +7,18 @@ #include "cmCTest.h" #include "cmCTestVC.h" +#include "cmExecutionStatus.h" #include "cmGeneratedFileStream.h" #include "cmMakefile.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" #include "cmValue.h" -class cmExecutionStatus; - bool cmCTestStartCommand::InitialPass(std::vector const& args, - cmExecutionStatus& /*unused*/) + cmExecutionStatus& status) { if (args.empty()) { - this->SetError("called with incorrect number of arguments"); + status.SetError("called with incorrect number of arguments"); return false; } @@ -37,7 +36,7 @@ bool cmCTestStartCommand::InitialPass(std::vector const& args, args[cnt] == "QUIET") { std::ostringstream e; e << args[cnt - 1] << " argument missing group name"; - this->SetError(e.str()); + status.SetError(e.str()); return false; } this->CTest->SetSpecificGroup(args[cnt].c_str()); @@ -58,30 +57,33 @@ bool cmCTestStartCommand::InitialPass(std::vector const& args, bld_dir = cmValue(args[cnt]); cnt++; } else { - this->SetError("Too many arguments"); + status.SetError("Too many arguments"); return false; } } + cmMakefile& mf = status.GetMakefile(); + if (!src_dir) { - src_dir = this->Makefile->GetDefinition("CTEST_SOURCE_DIRECTORY"); + src_dir = mf.GetDefinition("CTEST_SOURCE_DIRECTORY"); } if (!bld_dir) { - bld_dir = this->Makefile->GetDefinition("CTEST_BINARY_DIRECTORY"); + bld_dir = mf.GetDefinition("CTEST_BINARY_DIRECTORY"); } if (!src_dir) { - this->SetError("source directory not specified. Specify source directory " - "as an argument or set CTEST_SOURCE_DIRECTORY"); + status.SetError("source directory not specified. Specify source directory " + "as an argument or set CTEST_SOURCE_DIRECTORY"); return false; } if (!bld_dir) { - this->SetError("binary directory not specified. Specify binary directory " - "as an argument or set CTEST_BINARY_DIRECTORY"); + status.SetError("binary directory not specified. Specify binary directory " + "as an argument or set CTEST_BINARY_DIRECTORY"); return false; } if (!smodel && !append) { - this->SetError("no test model specified and APPEND not specified. Specify " - "either a test model or the APPEND argument"); + status.SetError( + "no test model specified and APPEND not specified. Specify " + "either a test model or the APPEND argument"); return false; } @@ -124,7 +126,7 @@ bool cmCTestStartCommand::InitialPass(std::vector const& args, } // Make sure the source directory exists. - if (!this->InitialCheckout(ofs, sourceDir)) { + if (!this->InitialCheckout(ofs, sourceDir, status)) { return false; } if (!cmSystemTools::FileIsDirectory(sourceDir)) { @@ -133,7 +135,7 @@ bool cmCTestStartCommand::InitialPass(std::vector const& args, << " " << sourceDir << "\n" << "which is not an existing directory. " << "Set CTEST_CHECKOUT_COMMAND to a command line to create it."; - this->SetError(e.str()); + status.SetError(e.str()); return false; } @@ -165,20 +167,20 @@ bool cmCTestStartCommand::InitialPass(std::vector const& args, cmCTestOptionalLog( this->CTest, OUTPUT, " Reading ctest configuration file: " << fname << std::endl, quiet); - bool readit = this->Makefile->ReadDependentFile(fname); + bool readit = mf.ReadDependentFile(fname); if (!readit) { std::string m = cmStrCat("Could not find include file: ", fname); - this->SetError(m); + status.SetError(m); return false; } } this->CTest->SetCTestConfigurationFromCMakeVariable( - this->Makefile, "NightlyStartTime", "CTEST_NIGHTLY_START_TIME", quiet); - this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, "Site", + &mf, "NightlyStartTime", "CTEST_NIGHTLY_START_TIME", quiet); + this->CTest->SetCTestConfigurationFromCMakeVariable(&mf, "Site", "CTEST_SITE", quiet); this->CTest->SetCTestConfigurationFromCMakeVariable( - this->Makefile, "BuildName", "CTEST_BUILD_NAME", quiet); + &mf, "BuildName", "CTEST_BUILD_NAME", quiet); this->CTest->Initialize(bld_dir); this->CTest->UpdateCTestConfiguration(); @@ -203,7 +205,7 @@ bool cmCTestStartCommand::InitialPass(std::vector const& args, return false; } - this->CTest->ReadCustomConfigurationFileTree(bld_dir, this->Makefile); + this->CTest->ReadCustomConfigurationFileTree(bld_dir, &mf); if (append) { if (!this->CTest->ReadExistingTag(quiet)) { @@ -223,14 +225,14 @@ bool cmCTestStartCommand::InitialPass(std::vector const& args, } bool cmCTestStartCommand::InitialCheckout(std::ostream& ofs, - std::string const& sourceDir) + std::string const& sourceDir, + cmExecutionStatus& status) { + cmMakefile& mf = status.GetMakefile(); // Use the user-provided command to create the source tree. - cmValue initialCheckoutCommand = - this->Makefile->GetDefinition("CTEST_CHECKOUT_COMMAND"); + cmValue initialCheckoutCommand = mf.GetDefinition("CTEST_CHECKOUT_COMMAND"); if (!initialCheckoutCommand) { - initialCheckoutCommand = - this->Makefile->GetDefinition("CTEST_CVS_CHECKOUT"); + initialCheckoutCommand = mf.GetDefinition("CTEST_CVS_CHECKOUT"); } if (initialCheckoutCommand) { // Use a generic VC object to run and log the command. diff --git a/Source/CTest/cmCTestStartCommand.h b/Source/CTest/cmCTestStartCommand.h index 22ae9bc7a4..b86e8a31f5 100644 --- a/Source/CTest/cmCTestStartCommand.h +++ b/Source/CTest/cmCTestStartCommand.h @@ -42,5 +42,6 @@ public: cmExecutionStatus& status) override; private: - bool InitialCheckout(std::ostream& ofs, std::string const& sourceDir); + bool InitialCheckout(std::ostream& ofs, std::string const& sourceDir, + cmExecutionStatus& status); }; diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx index d1ccca1dc6..913df58d4e 100644 --- a/Source/CTest/cmCTestSubmitCommand.cxx +++ b/Source/CTest/cmCTestSubmitCommand.cxx @@ -15,6 +15,7 @@ #include "cmCTestGenericHandler.h" #include "cmCTestSubmitHandler.h" #include "cmCommand.h" +#include "cmExecutionStatus.h" #include "cmList.h" #include "cmMakefile.h" #include "cmMessageType.h" @@ -22,8 +23,6 @@ #include "cmSystemTools.h" #include "cmValue.h" -class cmExecutionStatus; - std::unique_ptr cmCTestSubmitCommand::Clone() { auto ni = cm::make_unique(); @@ -32,9 +31,9 @@ std::unique_ptr cmCTestSubmitCommand::Clone() } std::unique_ptr cmCTestSubmitCommand::InitializeHandler( - HandlerArguments& arguments) + HandlerArguments& arguments, cmExecutionStatus& status) { - cmMakefile& mf = *this->Makefile; + cmMakefile& mf = status.GetMakefile(); auto const& args = static_cast(arguments); cmValue submitURL = !args.SubmitURL.empty() ? cmValue(args.SubmitURL) @@ -113,7 +112,7 @@ std::unique_ptr cmCTestSubmitCommand::InitializeHandler( if (extraFilesVariable) { cmList extraFiles{ *extraFilesVariable }; if (!this->CTest->SubmitExtraFiles(extraFiles)) { - this->SetError("problem submitting extra files."); + status.SetError("problem submitting extra files."); return nullptr; } } @@ -208,9 +207,10 @@ bool cmCTestSubmitCommand::InitialPass(std::vector const& args, }); } -void cmCTestSubmitCommand::CheckArguments(HandlerArguments& arguments) +void cmCTestSubmitCommand::CheckArguments(HandlerArguments& arguments, + cmExecutionStatus& status) { - cmMakefile& mf = *this->Makefile; + cmMakefile& mf = status.GetMakefile(); auto& args = static_cast(arguments); if (args.Parts) { cm::erase_if(*(args.Parts), [this, &mf](std::string const& arg) -> bool { @@ -240,9 +240,10 @@ void cmCTestSubmitCommand::CheckArguments(HandlerArguments& arguments) } void cmCTestSubmitCommand::ProcessAdditionalValues( - cmCTestGenericHandler*, HandlerArguments const& arguments) + cmCTestGenericHandler*, HandlerArguments const& arguments, + cmExecutionStatus& status) { - cmMakefile& mf = *this->Makefile; + cmMakefile& mf = status.GetMakefile(); auto const& args = static_cast(arguments); if (!args.BuildID.empty()) { mf.AddDefinition(args.BuildID, this->CTest->GetBuildID()); diff --git a/Source/CTest/cmCTestSubmitCommand.h b/Source/CTest/cmCTestSubmitCommand.h index 98eb629f27..92bca91abc 100644 --- a/Source/CTest/cmCTestSubmitCommand.h +++ b/Source/CTest/cmCTestSubmitCommand.h @@ -45,13 +45,15 @@ private: std::string GetName() const override { return "ctest_submit"; } - void CheckArguments(HandlerArguments& arguments) override; + void CheckArguments(HandlerArguments& arguments, + cmExecutionStatus& status) override; std::unique_ptr InitializeHandler( - HandlerArguments& arguments) override; + HandlerArguments& arguments, cmExecutionStatus& status) override; void ProcessAdditionalValues(cmCTestGenericHandler* handler, - HandlerArguments const& arguments) override; + HandlerArguments const& arguments, + cmExecutionStatus& status) override; bool InitialPass(std::vector const& args, cmExecutionStatus& status) override; diff --git a/Source/CTest/cmCTestTestCommand.cxx b/Source/CTest/cmCTestTestCommand.cxx index 932b42bf85..cdfca9beb5 100644 --- a/Source/CTest/cmCTestTestCommand.cxx +++ b/Source/CTest/cmCTestTestCommand.cxx @@ -16,12 +16,11 @@ #include "cmCTestTestHandler.h" #include "cmCommand.h" #include "cmDuration.h" +#include "cmExecutionStatus.h" #include "cmMakefile.h" #include "cmStringAlgorithms.h" #include "cmValue.h" -class cmExecutionStatus; - std::unique_ptr cmCTestTestCommand::Clone() { auto ni = cm::make_unique(); @@ -30,9 +29,9 @@ std::unique_ptr cmCTestTestCommand::Clone() } std::unique_ptr cmCTestTestCommand::InitializeHandler( - HandlerArguments& arguments) + HandlerArguments& arguments, cmExecutionStatus& status) { - cmMakefile& mf = *this->Makefile; + cmMakefile& mf = status.GetMakefile(); auto& args = static_cast(arguments); cmValue ctestTimeout = mf.GetDefinition("CTEST_TEST_TIMEOUT"); @@ -53,7 +52,7 @@ std::unique_ptr cmCTestTestCommand::InitializeHandler( args.ResourceSpecFile = *resourceSpecFile; } - auto handler = this->InitializeActualHandler(args); + auto handler = this->InitializeActualHandler(args, status); if (!args.Start.empty() || !args.End.empty() || !args.Stride.empty()) { handler->TestOptions.TestsToRunInformation = cmStrCat(args.Start, ',', args.End, ',', args.Stride); @@ -148,7 +147,8 @@ std::unique_ptr cmCTestTestCommand::InitializeHandler( } std::unique_ptr -cmCTestTestCommand::InitializeActualHandler(HandlerArguments&) +cmCTestTestCommand::InitializeActualHandler(HandlerArguments&, + cmExecutionStatus&) { return cm::make_unique(this->CTest); } diff --git a/Source/CTest/cmCTestTestCommand.h b/Source/CTest/cmCTestTestCommand.h index b9ac4d5927..25cb49f2fa 100644 --- a/Source/CTest/cmCTestTestCommand.h +++ b/Source/CTest/cmCTestTestCommand.h @@ -84,10 +84,10 @@ private: std::string GetName() const override { return "ctest_test"; } virtual std::unique_ptr InitializeActualHandler( - HandlerArguments& arguments); + HandlerArguments& arguments, cmExecutionStatus& status); std::unique_ptr InitializeHandler( - HandlerArguments& arguments) override; + HandlerArguments& arguments, cmExecutionStatus& status) override; bool InitialPass(std::vector const& args, cmExecutionStatus& status) override; diff --git a/Source/CTest/cmCTestUpdateCommand.cxx b/Source/CTest/cmCTestUpdateCommand.cxx index 059b488264..7874e4261e 100644 --- a/Source/CTest/cmCTestUpdateCommand.cxx +++ b/Source/CTest/cmCTestUpdateCommand.cxx @@ -10,6 +10,7 @@ #include "cmCTestGenericHandler.h" #include "cmCTestUpdateHandler.h" #include "cmCommand.h" +#include "cmExecutionStatus.h" #include "cmMakefile.h" #include "cmSystemTools.h" @@ -21,9 +22,9 @@ std::unique_ptr cmCTestUpdateCommand::Clone() } std::unique_ptr cmCTestUpdateCommand::InitializeHandler( - HandlerArguments& args) + HandlerArguments& args, cmExecutionStatus& status) { - cmMakefile& mf = *this->Makefile; + cmMakefile& mf = status.GetMakefile(); if (!args.Source.empty()) { this->CTest->SetCTestConfiguration( "SourceDirectory", cmSystemTools::CollapseFullPath(args.Source), @@ -83,7 +84,7 @@ std::unique_ptr cmCTestUpdateCommand::InitializeHandler( auto handler = cm::make_unique(this->CTest); if (source_dir.empty()) { - this->SetError("source directory not specified. Please use SOURCE tag"); + status.SetError("source directory not specified. Please use SOURCE tag"); return nullptr; } handler->SourceDirectory = source_dir; diff --git a/Source/CTest/cmCTestUpdateCommand.h b/Source/CTest/cmCTestUpdateCommand.h index 2058c9f4c2..d0604aec48 100644 --- a/Source/CTest/cmCTestUpdateCommand.h +++ b/Source/CTest/cmCTestUpdateCommand.h @@ -25,7 +25,7 @@ private: std::string GetName() const override { return "ctest_update"; } std::unique_ptr InitializeHandler( - HandlerArguments& args) override; + HandlerArguments& args, cmExecutionStatus& status) override; bool InitialPass(std::vector const& args, cmExecutionStatus& status) override; diff --git a/Source/CTest/cmCTestUploadCommand.cxx b/Source/CTest/cmCTestUploadCommand.cxx index d32d9e4419..4504b58671 100644 --- a/Source/CTest/cmCTestUploadCommand.cxx +++ b/Source/CTest/cmCTestUploadCommand.cxx @@ -14,12 +14,11 @@ #include "cmCTestGenericHandler.h" #include "cmCTestUploadHandler.h" #include "cmCommand.h" +#include "cmExecutionStatus.h" #include "cmMakefile.h" #include "cmMessageType.h" #include "cmSystemTools.h" -class cmExecutionStatus; - std::unique_ptr cmCTestUploadCommand::Clone() { auto ni = cm::make_unique(); @@ -27,9 +26,10 @@ std::unique_ptr cmCTestUploadCommand::Clone() return std::unique_ptr(std::move(ni)); } -void cmCTestUploadCommand::CheckArguments(HandlerArguments& arguments) +void cmCTestUploadCommand::CheckArguments(HandlerArguments& arguments, + cmExecutionStatus& status) { - cmMakefile& mf = *this->Makefile; + cmMakefile& mf = status.GetMakefile(); auto& args = static_cast(arguments); cm::erase_if(args.Files, [&mf](std::string const& arg) -> bool { if (!cmSystemTools::FileExists(arg)) { @@ -44,7 +44,7 @@ void cmCTestUploadCommand::CheckArguments(HandlerArguments& arguments) } std::unique_ptr cmCTestUploadCommand::InitializeHandler( - HandlerArguments& arguments) + HandlerArguments& arguments, cmExecutionStatus&) { auto const& args = static_cast(arguments); auto handler = cm::make_unique(this->CTest); diff --git a/Source/CTest/cmCTestUploadCommand.h b/Source/CTest/cmCTestUploadCommand.h index 4f70763c64..fffd90f143 100644 --- a/Source/CTest/cmCTestUploadCommand.h +++ b/Source/CTest/cmCTestUploadCommand.h @@ -31,10 +31,11 @@ private: std::string GetName() const override { return "ctest_upload"; } - void CheckArguments(HandlerArguments& arguments) override; + void CheckArguments(HandlerArguments& arguments, + cmExecutionStatus& status) override; std::unique_ptr InitializeHandler( - HandlerArguments& arguments) override; + HandlerArguments& arguments, cmExecutionStatus& status) override; bool InitialPass(std::vector const& args, cmExecutionStatus& status) override;