cmCTest*Command: Access Makefile through an alias

At the top of each function that requires access to Makefile,
declare an alias `mf = this->Makefile`.  Then replace all occurrences
of `this->Makefile->` with `mf.`.  The intention is to make following
changes easier to review.
This commit is contained in:
Daniel Pfeifer
2024-10-30 20:47:08 +01:00
parent caa449493b
commit 26a697f7c1
9 changed files with 108 additions and 116 deletions
+16 -18
View File
@@ -51,17 +51,16 @@ bool cmCTestBuildCommand::InitialPass(std::vector<std::string> const& args,
std::unique_ptr<cmCTestGenericHandler> cmCTestBuildCommand::InitializeHandler(
HandlerArguments& arguments)
{
cmMakefile& mf = *this->Makefile;
auto const& args = static_cast<BuildArguments&>(arguments);
auto handler = cm::make_unique<cmCTestBuildHandler>(this->CTest);
cmValue ctestBuildCommand =
this->Makefile->GetDefinition("CTEST_BUILD_COMMAND");
cmValue ctestBuildCommand = mf.GetDefinition("CTEST_BUILD_COMMAND");
if (cmNonempty(ctestBuildCommand)) {
this->CTest->SetCTestConfiguration("MakeCommand", *ctestBuildCommand,
args.Quiet);
} else {
cmValue cmakeGeneratorName =
this->Makefile->GetDefinition("CTEST_CMAKE_GENERATOR");
cmValue cmakeGeneratorName = mf.GetDefinition("CTEST_CMAKE_GENERATOR");
// Build configuration is determined by: CONFIGURATION argument,
// or CTEST_BUILD_CONFIGURATION script variable, or
@@ -69,7 +68,7 @@ std::unique_ptr<cmCTestGenericHandler> cmCTestBuildCommand::InitializeHandler(
// line argument... in that order.
//
cmValue ctestBuildConfiguration =
this->Makefile->GetDefinition("CTEST_BUILD_CONFIGURATION");
mf.GetDefinition("CTEST_BUILD_CONFIGURATION");
std::string cmakeBuildConfiguration = cmNonempty(args.Configuration)
? args.Configuration
: cmNonempty(ctestBuildConfiguration) ? *ctestBuildConfiguration
@@ -77,10 +76,10 @@ std::unique_ptr<cmCTestGenericHandler> cmCTestBuildCommand::InitializeHandler(
const std::string& cmakeBuildAdditionalFlags = cmNonempty(args.Flags)
? args.Flags
: this->Makefile->GetSafeDefinition("CTEST_BUILD_FLAGS");
: mf.GetSafeDefinition("CTEST_BUILD_FLAGS");
const std::string& cmakeBuildTarget = cmNonempty(args.Target)
? args.Target
: this->Makefile->GetSafeDefinition("CTEST_BUILD_TARGET");
: mf.GetSafeDefinition("CTEST_BUILD_TARGET");
if (cmNonempty(cmakeGeneratorName)) {
if (cmakeBuildConfiguration.empty()) {
@@ -88,12 +87,11 @@ std::unique_ptr<cmCTestGenericHandler> cmCTestBuildCommand::InitializeHandler(
}
auto globalGenerator =
this->Makefile->GetCMakeInstance()->CreateGlobalGenerator(
*cmakeGeneratorName);
mf.GetCMakeInstance()->CreateGlobalGenerator(*cmakeGeneratorName);
if (!globalGenerator) {
std::string e = cmStrCat("could not create generator named \"",
*cmakeGeneratorName, '"');
this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e);
mf.IssueMessage(MessageType::FATAL_ERROR, e);
cmSystemTools::SetFatalErrorOccurred();
return nullptr;
}
@@ -104,7 +102,7 @@ std::unique_ptr<cmCTestGenericHandler> cmCTestBuildCommand::InitializeHandler(
std::string dir = this->CTest->GetCTestConfiguration("BuildDirectory");
std::string buildCommand = globalGenerator->GenerateCMakeBuildCommand(
cmakeBuildTarget, cmakeBuildConfiguration, args.ParallelLevel,
cmakeBuildAdditionalFlags, this->Makefile->IgnoreErrorsCMP0061());
cmakeBuildAdditionalFlags, mf.IgnoreErrorsCMP0061());
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"SetMakeCommand:" << buildCommand << "\n",
args.Quiet);
@@ -123,14 +121,13 @@ std::unique_ptr<cmCTestGenericHandler> cmCTestBuildCommand::InitializeHandler(
}
}
if (cmValue useLaunchers =
this->Makefile->GetDefinition("CTEST_USE_LAUNCHERS")) {
if (cmValue useLaunchers = mf.GetDefinition("CTEST_USE_LAUNCHERS")) {
this->CTest->SetCTestConfiguration("UseLaunchers", *useLaunchers,
args.Quiet);
}
if (cmValue labelsForSubprojects =
this->Makefile->GetDefinition("CTEST_LABELS_FOR_SUBPROJECTS")) {
mf.GetDefinition("CTEST_LABELS_FOR_SUBPROJECTS")) {
this->CTest->SetCTestConfiguration("LabelsForSubprojects",
*labelsForSubprojects, args.Quiet);
}
@@ -142,14 +139,15 @@ std::unique_ptr<cmCTestGenericHandler> cmCTestBuildCommand::InitializeHandler(
void cmCTestBuildCommand::ProcessAdditionalValues(
cmCTestGenericHandler* generic, HandlerArguments const& arguments)
{
cmMakefile& mf = *this->Makefile;
auto const& args = static_cast<BuildArguments const&>(arguments);
auto const* handler = static_cast<cmCTestBuildHandler*>(generic);
if (!args.NumberErrors.empty()) {
this->Makefile->AddDefinition(args.NumberErrors,
std::to_string(handler->GetTotalErrors()));
mf.AddDefinition(args.NumberErrors,
std::to_string(handler->GetTotalErrors()));
}
if (!args.NumberWarnings.empty()) {
this->Makefile->AddDefinition(args.NumberWarnings,
std::to_string(handler->GetTotalWarnings()));
mf.AddDefinition(args.NumberWarnings,
std::to_string(handler->GetTotalWarnings()));
}
}
+9 -10
View File
@@ -33,6 +33,7 @@ std::unique_ptr<cmCommand> cmCTestConfigureCommand::Clone()
std::unique_ptr<cmCTestGenericHandler>
cmCTestConfigureCommand::InitializeHandler(HandlerArguments& arguments)
{
cmMakefile& mf = *this->Makefile;
auto const& args = static_cast<ConfigureArguments&>(arguments);
cmList options;
@@ -48,15 +49,13 @@ cmCTestConfigureCommand::InitializeHandler(HandlerArguments& arguments)
return nullptr;
}
cmValue ctestConfigureCommand =
this->Makefile->GetDefinition("CTEST_CONFIGURE_COMMAND");
cmValue ctestConfigureCommand = mf.GetDefinition("CTEST_CONFIGURE_COMMAND");
if (cmNonempty(ctestConfigureCommand)) {
this->CTest->SetCTestConfiguration("ConfigureCommand",
*ctestConfigureCommand, args.Quiet);
} else {
cmValue cmakeGeneratorName =
this->Makefile->GetDefinition("CTEST_CMAKE_GENERATOR");
cmValue cmakeGeneratorName = mf.GetDefinition("CTEST_CMAKE_GENERATOR");
if (cmNonempty(cmakeGeneratorName)) {
const std::string& source_dir =
this->CTest->GetCTestConfiguration("SourceDirectory");
@@ -79,8 +78,8 @@ cmCTestConfigureCommand::InitializeHandler(HandlerArguments& arguments)
bool multiConfig = false;
bool cmakeBuildTypeInOptions = false;
auto gg = this->Makefile->GetCMakeInstance()->CreateGlobalGenerator(
*cmakeGeneratorName);
auto gg =
mf.GetCMakeInstance()->CreateGlobalGenerator(*cmakeGeneratorName);
if (gg) {
multiConfig = gg->IsMultiConfig();
gg.reset();
@@ -107,7 +106,7 @@ cmCTestConfigureCommand::InitializeHandler(HandlerArguments& arguments)
cmakeConfigureCommand += "\"";
}
if (this->Makefile->IsOn("CTEST_USE_LAUNCHERS")) {
if (mf.IsOn("CTEST_USE_LAUNCHERS")) {
cmakeConfigureCommand += " \"-DCTEST_USE_LAUNCHERS:BOOL=TRUE\"";
}
@@ -116,7 +115,7 @@ cmCTestConfigureCommand::InitializeHandler(HandlerArguments& arguments)
cmakeConfigureCommand += "\"";
cmValue cmakeGeneratorPlatform =
this->Makefile->GetDefinition("CTEST_CMAKE_GENERATOR_PLATFORM");
mf.GetDefinition("CTEST_CMAKE_GENERATOR_PLATFORM");
if (cmNonempty(cmakeGeneratorPlatform)) {
cmakeConfigureCommand += " \"-A";
cmakeConfigureCommand += *cmakeGeneratorPlatform;
@@ -124,7 +123,7 @@ cmCTestConfigureCommand::InitializeHandler(HandlerArguments& arguments)
}
cmValue cmakeGeneratorToolset =
this->Makefile->GetDefinition("CTEST_CMAKE_GENERATOR_TOOLSET");
mf.GetDefinition("CTEST_CMAKE_GENERATOR_TOOLSET");
if (cmNonempty(cmakeGeneratorToolset)) {
cmakeConfigureCommand += " \"-T";
cmakeConfigureCommand += *cmakeGeneratorToolset;
@@ -152,7 +151,7 @@ cmCTestConfigureCommand::InitializeHandler(HandlerArguments& arguments)
}
if (cmValue labelsForSubprojects =
this->Makefile->GetDefinition("CTEST_LABELS_FOR_SUBPROJECTS")) {
mf.GetDefinition("CTEST_LABELS_FOR_SUBPROJECTS")) {
this->CTest->SetCTestConfiguration("LabelsForSubprojects",
*labelsForSubprojects, args.Quiet);
}
+5 -3
View File
@@ -14,6 +14,8 @@
#include "cmCTestGenericHandler.h"
#include "cmCommand.h"
class cmMakefile;
std::unique_ptr<cmCommand> cmCTestCoverageCommand::Clone()
{
auto ni = cm::make_unique<cmCTestCoverageCommand>();
@@ -24,12 +26,12 @@ std::unique_ptr<cmCommand> cmCTestCoverageCommand::Clone()
std::unique_ptr<cmCTestGenericHandler>
cmCTestCoverageCommand::InitializeHandler(HandlerArguments& arguments)
{
cmMakefile& mf = *this->Makefile;
auto& args = static_cast<CoverageArguments&>(arguments);
this->CTest->SetCTestConfigurationFromCMakeVariable(
this->Makefile, "CoverageCommand", "CTEST_COVERAGE_COMMAND", args.Quiet);
&mf, "CoverageCommand", "CTEST_COVERAGE_COMMAND", args.Quiet);
this->CTest->SetCTestConfigurationFromCMakeVariable(
this->Makefile, "CoverageExtraFlags", "CTEST_COVERAGE_EXTRA_FLAGS",
args.Quiet);
&mf, "CoverageExtraFlags", "CTEST_COVERAGE_EXTRA_FLAGS", args.Quiet);
auto handler = cm::make_unique<cmCTestCoverageHandler>(this->CTest);
// If a LABELS option was given, select only files with the labels.
+12 -12
View File
@@ -116,9 +116,11 @@ bool cmCTestHandlerCommand::InvokeImpl(
return true;
}
bool cmCTestHandlerCommand::ExecuteHandlerCommand(
HandlerArguments& args, cmExecutionStatus& /*status*/)
bool cmCTestHandlerCommand::ExecuteHandlerCommand(HandlerArguments& args,
cmExecutionStatus& status)
{
cmMakefile& mf = status.GetMakefile();
// Process input arguments.
this->CheckArguments(args);
@@ -126,8 +128,7 @@ bool cmCTestHandlerCommand::ExecuteHandlerCommand(
// CTEST_CONFIGURATION_TYPE script variable if it is defined.
// The current script value trumps the -C argument on the command
// line.
cmValue ctestConfigType =
this->Makefile->GetDefinition("CTEST_CONFIGURATION_TYPE");
cmValue ctestConfigType = mf.GetDefinition("CTEST_CONFIGURATION_TYPE");
if (ctestConfigType) {
this->CTest->SetConfigType(*ctestConfigType);
}
@@ -137,8 +138,7 @@ bool cmCTestHandlerCommand::ExecuteHandlerCommand(
"BuildDirectory", cmSystemTools::CollapseFullPath(args.Build),
args.Quiet);
} else {
std::string const& bdir =
this->Makefile->GetSafeDefinition("CTEST_BINARY_DIRECTORY");
std::string const& bdir = mf.GetSafeDefinition("CTEST_BINARY_DIRECTORY");
if (!bdir.empty()) {
this->CTest->SetCTestConfiguration(
"BuildDirectory", cmSystemTools::CollapseFullPath(bdir), args.Quiet);
@@ -157,11 +157,11 @@ bool cmCTestHandlerCommand::ExecuteHandlerCommand(
this->CTest->SetCTestConfiguration(
"SourceDirectory",
cmSystemTools::CollapseFullPath(
this->Makefile->GetSafeDefinition("CTEST_SOURCE_DIRECTORY")),
mf.GetSafeDefinition("CTEST_SOURCE_DIRECTORY")),
args.Quiet);
}
if (cmValue changeId = this->Makefile->GetDefinition("CTEST_CHANGE_ID")) {
if (cmValue changeId = mf.GetDefinition("CTEST_CHANGE_ID")) {
this->CTest->SetCTestConfiguration("ChangeId", *changeId, args.Quiet);
}
@@ -176,7 +176,7 @@ bool cmCTestHandlerCommand::ExecuteHandlerCommand(
handler->SetAppendXML(args.Append);
handler->PopulateCustomVectors(this->Makefile);
handler->PopulateCustomVectors(&mf);
if (!args.SubmitIndex.empty()) {
handler->SetSubmitIndex(atoi(args.SubmitIndex.c_str()));
}
@@ -188,12 +188,12 @@ bool cmCTestHandlerCommand::ExecuteHandlerCommand(
}
// reread time limit, as the variable may have been modified.
this->CTest->SetTimeLimit(this->Makefile->GetDefinition("CTEST_TIME_LIMIT"));
handler->SetCMakeInstance(this->Makefile->GetCMakeInstance());
this->CTest->SetTimeLimit(mf.GetDefinition("CTEST_TIME_LIMIT"));
handler->SetCMakeInstance(mf.GetCMakeInstance());
int res = handler->ProcessHandler();
if (!args.ReturnValue.empty()) {
this->Makefile->AddDefinition(args.ReturnValue, std::to_string(res));
mf.AddDefinition(args.ReturnValue, std::to_string(res));
}
this->ProcessAdditionalValues(handler.get(), args);
return true;
+11 -10
View File
@@ -24,22 +24,22 @@ std::unique_ptr<cmCommand> cmCTestMemCheckCommand::Clone()
std::unique_ptr<cmCTestTestHandler>
cmCTestMemCheckCommand::InitializeActualHandler(HandlerArguments& args)
{
cmMakefile& mf = *this->Makefile;
auto handler = cm::make_unique<cmCTestMemCheckHandler>(this->CTest);
this->CTest->SetCTestConfigurationFromCMakeVariable(
this->Makefile, "MemoryCheckType", "CTEST_MEMORYCHECK_TYPE", args.Quiet);
&mf, "MemoryCheckType", "CTEST_MEMORYCHECK_TYPE", args.Quiet);
this->CTest->SetCTestConfigurationFromCMakeVariable(
this->Makefile, "MemoryCheckSanitizerOptions",
"CTEST_MEMORYCHECK_SANITIZER_OPTIONS", args.Quiet);
this->CTest->SetCTestConfigurationFromCMakeVariable(
this->Makefile, "MemoryCheckCommand", "CTEST_MEMORYCHECK_COMMAND",
&mf, "MemoryCheckSanitizerOptions", "CTEST_MEMORYCHECK_SANITIZER_OPTIONS",
args.Quiet);
this->CTest->SetCTestConfigurationFromCMakeVariable(
this->Makefile, "MemoryCheckCommandOptions",
"CTEST_MEMORYCHECK_COMMAND_OPTIONS", args.Quiet);
&mf, "MemoryCheckCommand", "CTEST_MEMORYCHECK_COMMAND", args.Quiet);
this->CTest->SetCTestConfigurationFromCMakeVariable(
this->Makefile, "MemoryCheckSuppressionFile",
"CTEST_MEMORYCHECK_SUPPRESSIONS_FILE", args.Quiet);
&mf, "MemoryCheckCommandOptions", "CTEST_MEMORYCHECK_COMMAND_OPTIONS",
args.Quiet);
this->CTest->SetCTestConfigurationFromCMakeVariable(
&mf, "MemoryCheckSuppressionFile", "CTEST_MEMORYCHECK_SUPPRESSIONS_FILE",
args.Quiet);
handler->SetQuiet(args.Quiet);
return std::unique_ptr<cmCTestTestHandler>(std::move(handler));
@@ -48,9 +48,10 @@ cmCTestMemCheckCommand::InitializeActualHandler(HandlerArguments& args)
void cmCTestMemCheckCommand::ProcessAdditionalValues(
cmCTestGenericHandler* handler, HandlerArguments const& arguments)
{
cmMakefile& mf = *this->Makefile;
auto const& args = static_cast<MemCheckArguments const&>(arguments);
if (!args.DefectCount.empty()) {
this->Makefile->AddDefinition(
mf.AddDefinition(
args.DefectCount,
std::to_string(
static_cast<cmCTestMemCheckHandler*>(handler)->GetDefectCount()));
+24 -27
View File
@@ -34,31 +34,30 @@ std::unique_ptr<cmCommand> cmCTestSubmitCommand::Clone()
std::unique_ptr<cmCTestGenericHandler> cmCTestSubmitCommand::InitializeHandler(
HandlerArguments& arguments)
{
cmMakefile& mf = *this->Makefile;
auto const& args = static_cast<SubmitArguments&>(arguments);
cmValue submitURL = !args.SubmitURL.empty()
? cmValue(args.SubmitURL)
: this->Makefile->GetDefinition("CTEST_SUBMIT_URL");
: mf.GetDefinition("CTEST_SUBMIT_URL");
if (submitURL) {
this->CTest->SetCTestConfiguration("SubmitURL", *submitURL, args.Quiet);
} else {
this->CTest->SetCTestConfigurationFromCMakeVariable(
this->Makefile, "DropMethod", "CTEST_DROP_METHOD", args.Quiet);
&mf, "DropMethod", "CTEST_DROP_METHOD", args.Quiet);
this->CTest->SetCTestConfigurationFromCMakeVariable(
this->Makefile, "DropSiteUser", "CTEST_DROP_SITE_USER", args.Quiet);
&mf, "DropSiteUser", "CTEST_DROP_SITE_USER", args.Quiet);
this->CTest->SetCTestConfigurationFromCMakeVariable(
this->Makefile, "DropSitePassword", "CTEST_DROP_SITE_PASSWORD",
args.Quiet);
&mf, "DropSitePassword", "CTEST_DROP_SITE_PASSWORD", args.Quiet);
this->CTest->SetCTestConfigurationFromCMakeVariable(
this->Makefile, "DropSite", "CTEST_DROP_SITE", args.Quiet);
&mf, "DropSite", "CTEST_DROP_SITE", args.Quiet);
this->CTest->SetCTestConfigurationFromCMakeVariable(
this->Makefile, "DropLocation", "CTEST_DROP_LOCATION", args.Quiet);
&mf, "DropLocation", "CTEST_DROP_LOCATION", args.Quiet);
}
if (!this->CTest->SetCTestConfigurationFromCMakeVariable(
this->Makefile, "TLSVersion", "CTEST_TLS_VERSION", args.Quiet)) {
if (cmValue tlsVersionVar =
this->Makefile->GetDefinition("CMAKE_TLS_VERSION")) {
&mf, "TLSVersion", "CTEST_TLS_VERSION", args.Quiet)) {
if (cmValue tlsVersionVar = mf.GetDefinition("CMAKE_TLS_VERSION")) {
cmCTestOptionalLog(
this->CTest, HANDLER_VERBOSE_OUTPUT,
"SetCTestConfiguration from CMAKE_TLS_VERSION:TLSVersion:"
@@ -78,9 +77,8 @@ std::unique_ptr<cmCTestGenericHandler> cmCTestSubmitCommand::InitializeHandler(
}
}
if (!this->CTest->SetCTestConfigurationFromCMakeVariable(
this->Makefile, "TLSVerify", "CTEST_TLS_VERIFY", args.Quiet)) {
if (cmValue tlsVerifyVar =
this->Makefile->GetDefinition("CMAKE_TLS_VERIFY")) {
&mf, "TLSVerify", "CTEST_TLS_VERIFY", args.Quiet)) {
if (cmValue tlsVerifyVar = mf.GetDefinition("CMAKE_TLS_VERIFY")) {
cmCTestOptionalLog(
this->CTest, HANDLER_VERBOSE_OUTPUT,
"SetCTestConfiguration from CMAKE_TLS_VERIFY:TLSVerify:"
@@ -100,21 +98,18 @@ std::unique_ptr<cmCTestGenericHandler> cmCTestSubmitCommand::InitializeHandler(
}
}
this->CTest->SetCTestConfigurationFromCMakeVariable(
this->Makefile, "CurlOptions", "CTEST_CURL_OPTIONS", args.Quiet);
&mf, "CurlOptions", "CTEST_CURL_OPTIONS", args.Quiet);
this->CTest->SetCTestConfigurationFromCMakeVariable(
this->Makefile, "SubmitInactivityTimeout",
"CTEST_SUBMIT_INACTIVITY_TIMEOUT", args.Quiet);
&mf, "SubmitInactivityTimeout", "CTEST_SUBMIT_INACTIVITY_TIMEOUT",
args.Quiet);
cmValue notesFilesVariable =
this->Makefile->GetDefinition("CTEST_NOTES_FILES");
cmValue notesFilesVariable = mf.GetDefinition("CTEST_NOTES_FILES");
if (notesFilesVariable) {
cmList notesFiles{ *notesFilesVariable };
this->CTest->GenerateNotesFile(this->Makefile->GetCMakeInstance(),
notesFiles);
this->CTest->GenerateNotesFile(mf.GetCMakeInstance(), notesFiles);
}
cmValue extraFilesVariable =
this->Makefile->GetDefinition("CTEST_EXTRA_SUBMIT_FILES");
cmValue extraFilesVariable = mf.GetDefinition("CTEST_EXTRA_SUBMIT_FILES");
if (extraFilesVariable) {
cmList extraFiles{ *extraFilesVariable };
if (!this->CTest->SubmitExtraFiles(extraFiles)) {
@@ -215,14 +210,15 @@ bool cmCTestSubmitCommand::InitialPass(std::vector<std::string> const& args,
void cmCTestSubmitCommand::CheckArguments(HandlerArguments& arguments)
{
cmMakefile& mf = *this->Makefile;
auto& args = static_cast<SubmitArguments&>(arguments);
if (args.Parts) {
cm::erase_if(*(args.Parts), [this](std::string const& arg) -> bool {
cm::erase_if(*(args.Parts), [this, &mf](std::string const& arg) -> bool {
cmCTest::Part p = this->CTest->GetPartFromName(arg);
if (p == cmCTest::PartCount) {
std::ostringstream e;
e << "Part name \"" << arg << "\" is invalid.";
this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str());
mf.IssueMessage(MessageType::FATAL_ERROR, e.str());
return true;
}
return false;
@@ -230,12 +226,12 @@ void cmCTestSubmitCommand::CheckArguments(HandlerArguments& arguments)
}
if (args.Files) {
cm::erase_if(*(args.Files), [this](std::string const& arg) -> bool {
cm::erase_if(*(args.Files), [&mf](std::string const& arg) -> bool {
if (!cmSystemTools::FileExists(arg)) {
std::ostringstream e;
e << "File \"" << arg << "\" does not exist. Cannot submit "
<< "a non-existent file.";
this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str());
mf.IssueMessage(MessageType::FATAL_ERROR, e.str());
return true;
}
return false;
@@ -246,8 +242,9 @@ void cmCTestSubmitCommand::CheckArguments(HandlerArguments& arguments)
void cmCTestSubmitCommand::ProcessAdditionalValues(
cmCTestGenericHandler*, HandlerArguments const& arguments)
{
cmMakefile& mf = *this->Makefile;
auto const& args = static_cast<SubmitArguments const&>(arguments);
if (!args.BuildID.empty()) {
this->Makefile->AddDefinition(args.BuildID, this->CTest->GetBuildID());
mf.AddDefinition(args.BuildID, this->CTest->GetBuildID());
}
}
+5 -5
View File
@@ -32,8 +32,9 @@ std::unique_ptr<cmCommand> cmCTestTestCommand::Clone()
std::unique_ptr<cmCTestGenericHandler> cmCTestTestCommand::InitializeHandler(
HandlerArguments& arguments)
{
cmMakefile& mf = *this->Makefile;
auto& args = static_cast<TestArguments&>(arguments);
cmValue ctestTimeout = this->Makefile->GetDefinition("CTEST_TEST_TIMEOUT");
cmValue ctestTimeout = mf.GetDefinition("CTEST_TEST_TIMEOUT");
cmDuration timeout;
if (ctestTimeout) {
@@ -47,8 +48,7 @@ std::unique_ptr<cmCTestGenericHandler> cmCTestTestCommand::InitializeHandler(
}
this->CTest->SetTimeOut(timeout);
cmValue resourceSpecFile =
this->Makefile->GetDefinition("CTEST_RESOURCE_SPEC_FILE");
cmValue resourceSpecFile = mf.GetDefinition("CTEST_RESOURCE_SPEC_FILE");
if (args.ResourceSpecFile.empty() && resourceSpecFile) {
args.ResourceSpecFile = *resourceSpecFile;
}
@@ -113,7 +113,7 @@ std::unique_ptr<cmCTestGenericHandler> cmCTestTestCommand::InitializeHandler(
// or CTEST_TEST_LOAD script variable, or ctest --test-load
// command line argument... in that order.
unsigned long testLoad;
cmValue ctestTestLoad = this->Makefile->GetDefinition("CTEST_TEST_LOAD");
cmValue ctestTestLoad = mf.GetDefinition("CTEST_TEST_LOAD");
if (!args.TestLoad.empty()) {
if (!cmStrToULong(args.TestLoad, &testLoad)) {
testLoad = 0;
@@ -134,7 +134,7 @@ std::unique_ptr<cmCTestGenericHandler> cmCTestTestCommand::InitializeHandler(
handler->SetTestLoad(testLoad);
if (cmValue labelsForSubprojects =
this->Makefile->GetDefinition("CTEST_LABELS_FOR_SUBPROJECTS")) {
mf.GetDefinition("CTEST_LABELS_FOR_SUBPROJECTS")) {
this->CTest->SetCTestConfiguration("LabelsForSubprojects",
*labelsForSubprojects, args.Quiet);
}
+23 -29
View File
@@ -23,6 +23,7 @@ std::unique_ptr<cmCommand> cmCTestUpdateCommand::Clone()
std::unique_ptr<cmCTestGenericHandler> cmCTestUpdateCommand::InitializeHandler(
HandlerArguments& args)
{
cmMakefile& mf = *this->Makefile;
if (!args.Source.empty()) {
this->CTest->SetCTestConfiguration(
"SourceDirectory", cmSystemTools::CollapseFullPath(args.Source),
@@ -31,61 +32,54 @@ std::unique_ptr<cmCTestGenericHandler> cmCTestUpdateCommand::InitializeHandler(
this->CTest->SetCTestConfiguration(
"SourceDirectory",
cmSystemTools::CollapseFullPath(
this->Makefile->GetSafeDefinition("CTEST_SOURCE_DIRECTORY")),
mf.GetSafeDefinition("CTEST_SOURCE_DIRECTORY")),
args.Quiet);
}
std::string source_dir =
this->CTest->GetCTestConfiguration("SourceDirectory");
this->CTest->SetCTestConfigurationFromCMakeVariable(
this->Makefile, "UpdateCommand", "CTEST_UPDATE_COMMAND", args.Quiet);
&mf, "UpdateCommand", "CTEST_UPDATE_COMMAND", args.Quiet);
this->CTest->SetCTestConfigurationFromCMakeVariable(
this->Makefile, "UpdateOptions", "CTEST_UPDATE_OPTIONS", args.Quiet);
&mf, "UpdateOptions", "CTEST_UPDATE_OPTIONS", args.Quiet);
this->CTest->SetCTestConfigurationFromCMakeVariable(
this->Makefile, "CVSCommand", "CTEST_CVS_COMMAND", args.Quiet);
&mf, "CVSCommand", "CTEST_CVS_COMMAND", args.Quiet);
this->CTest->SetCTestConfigurationFromCMakeVariable(
this->Makefile, "CVSUpdateOptions", "CTEST_CVS_UPDATE_OPTIONS",
args.Quiet);
&mf, "CVSUpdateOptions", "CTEST_CVS_UPDATE_OPTIONS", args.Quiet);
this->CTest->SetCTestConfigurationFromCMakeVariable(
this->Makefile, "SVNCommand", "CTEST_SVN_COMMAND", args.Quiet);
&mf, "SVNCommand", "CTEST_SVN_COMMAND", args.Quiet);
this->CTest->SetCTestConfigurationFromCMakeVariable(
this->Makefile, "SVNUpdateOptions", "CTEST_SVN_UPDATE_OPTIONS",
args.Quiet);
&mf, "SVNUpdateOptions", "CTEST_SVN_UPDATE_OPTIONS", args.Quiet);
this->CTest->SetCTestConfigurationFromCMakeVariable(
this->Makefile, "SVNOptions", "CTEST_SVN_OPTIONS", args.Quiet);
&mf, "SVNOptions", "CTEST_SVN_OPTIONS", args.Quiet);
this->CTest->SetCTestConfigurationFromCMakeVariable(
this->Makefile, "BZRCommand", "CTEST_BZR_COMMAND", args.Quiet);
&mf, "BZRCommand", "CTEST_BZR_COMMAND", args.Quiet);
this->CTest->SetCTestConfigurationFromCMakeVariable(
this->Makefile, "BZRUpdateOptions", "CTEST_BZR_UPDATE_OPTIONS",
args.Quiet);
&mf, "BZRUpdateOptions", "CTEST_BZR_UPDATE_OPTIONS", args.Quiet);
this->CTest->SetCTestConfigurationFromCMakeVariable(
this->Makefile, "GITCommand", "CTEST_GIT_COMMAND", args.Quiet);
&mf, "GITCommand", "CTEST_GIT_COMMAND", args.Quiet);
this->CTest->SetCTestConfigurationFromCMakeVariable(
this->Makefile, "GITUpdateOptions", "CTEST_GIT_UPDATE_OPTIONS",
args.Quiet);
&mf, "GITUpdateOptions", "CTEST_GIT_UPDATE_OPTIONS", args.Quiet);
this->CTest->SetCTestConfigurationFromCMakeVariable(
this->Makefile, "GITInitSubmodules", "CTEST_GIT_INIT_SUBMODULES",
args.Quiet);
&mf, "GITInitSubmodules", "CTEST_GIT_INIT_SUBMODULES", args.Quiet);
this->CTest->SetCTestConfigurationFromCMakeVariable(
this->Makefile, "GITUpdateCustom", "CTEST_GIT_UPDATE_CUSTOM", args.Quiet);
&mf, "GITUpdateCustom", "CTEST_GIT_UPDATE_CUSTOM", args.Quiet);
this->CTest->SetCTestConfigurationFromCMakeVariable(
this->Makefile, "UpdateVersionOnly", "CTEST_UPDATE_VERSION_ONLY",
args.Quiet);
&mf, "UpdateVersionOnly", "CTEST_UPDATE_VERSION_ONLY", args.Quiet);
this->CTest->SetCTestConfigurationFromCMakeVariable(
this->Makefile, "UpdateVersionOverride", "CTEST_UPDATE_VERSION_OVERRIDE",
args.Quiet);
&mf, "UpdateVersionOverride", "CTEST_UPDATE_VERSION_OVERRIDE", args.Quiet);
this->CTest->SetCTestConfigurationFromCMakeVariable(
this->Makefile, "HGCommand", "CTEST_HG_COMMAND", args.Quiet);
&mf, "HGCommand", "CTEST_HG_COMMAND", args.Quiet);
this->CTest->SetCTestConfigurationFromCMakeVariable(
this->Makefile, "HGUpdateOptions", "CTEST_HG_UPDATE_OPTIONS", args.Quiet);
&mf, "HGUpdateOptions", "CTEST_HG_UPDATE_OPTIONS", args.Quiet);
this->CTest->SetCTestConfigurationFromCMakeVariable(
this->Makefile, "P4Command", "CTEST_P4_COMMAND", args.Quiet);
&mf, "P4Command", "CTEST_P4_COMMAND", args.Quiet);
this->CTest->SetCTestConfigurationFromCMakeVariable(
this->Makefile, "P4UpdateOptions", "CTEST_P4_UPDATE_OPTIONS", args.Quiet);
&mf, "P4UpdateOptions", "CTEST_P4_UPDATE_OPTIONS", args.Quiet);
this->CTest->SetCTestConfigurationFromCMakeVariable(
this->Makefile, "P4Client", "CTEST_P4_CLIENT", args.Quiet);
&mf, "P4Client", "CTEST_P4_CLIENT", args.Quiet);
this->CTest->SetCTestConfigurationFromCMakeVariable(
this->Makefile, "P4Options", "CTEST_P4_OPTIONS", args.Quiet);
&mf, "P4Options", "CTEST_P4_OPTIONS", args.Quiet);
auto handler = cm::make_unique<cmCTestUpdateHandler>(this->CTest);
if (source_dir.empty()) {
+3 -2
View File
@@ -29,13 +29,14 @@ std::unique_ptr<cmCommand> cmCTestUploadCommand::Clone()
void cmCTestUploadCommand::CheckArguments(HandlerArguments& arguments)
{
cmMakefile& mf = *this->Makefile;
auto& args = static_cast<UploadArguments&>(arguments);
cm::erase_if(args.Files, [this](std::string const& arg) -> bool {
cm::erase_if(args.Files, [&mf](std::string const& arg) -> bool {
if (!cmSystemTools::FileExists(arg)) {
std::ostringstream e;
e << "File \"" << arg << "\" does not exist. Cannot submit "
<< "a non-existent file.";
this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str());
mf.IssueMessage(MessageType::FATAL_ERROR, e.str());
return true;
}
return false;