mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-07 22:30:13 -06:00
cmCTest: Separate initialization of script and command line
This commit is contained in:
committed by
Brad King
parent
402af107a5
commit
0bfe17e15b
@@ -190,7 +190,7 @@ bool cmCTestStartCommand::InitialPass(std::vector<std::string> const& args,
|
|||||||
this->CTest->SetCTestConfigurationFromCMakeVariable(
|
this->CTest->SetCTestConfigurationFromCMakeVariable(
|
||||||
this->Makefile, "BuildName", "CTEST_BUILD_NAME", this->Quiet);
|
this->Makefile, "BuildName", "CTEST_BUILD_NAME", this->Quiet);
|
||||||
|
|
||||||
if (!this->CTest->Initialize(bld_dir, this)) {
|
if (!this->CTest->Initialize(bld_dir, *this)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
cmCTestOptionalLog(this->CTest, OUTPUT,
|
cmCTestOptionalLog(this->CTest, OUTPUT,
|
||||||
|
|||||||
@@ -417,15 +417,13 @@ cmCTest::Part cmCTest::GetPartFromName(const std::string& name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool cmCTest::Initialize(const std::string& binary_dir,
|
bool cmCTest::Initialize(const std::string& binary_dir,
|
||||||
cmCTestStartCommand* command)
|
cmCTestStartCommand& command)
|
||||||
{
|
{
|
||||||
bool quiet = false;
|
bool const quiet = command.ShouldBeQuiet();
|
||||||
if (command) {
|
|
||||||
this->Impl->BuildID = "";
|
this->Impl->BuildID = "";
|
||||||
for (Part p = PartStart; p != PartCount; p = static_cast<Part>(p + 1)) {
|
for (Part p = PartStart; p != PartCount; p = static_cast<Part>(p + 1)) {
|
||||||
this->Impl->Parts[p].SubmitFiles.clear();
|
this->Impl->Parts[p].SubmitFiles.clear();
|
||||||
}
|
|
||||||
quiet = command->ShouldBeQuiet();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cmCTestOptionalLog(this, DEBUG, "Here: " << __LINE__ << std::endl, quiet);
|
cmCTestOptionalLog(this, DEBUG, "Here: " << __LINE__ << std::endl, quiet);
|
||||||
@@ -462,26 +460,13 @@ bool cmCTest::Initialize(const std::string& binary_dir,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmake cm(cmake::RoleScript, cmState::CTest);
|
cmMakefile* mf = command.GetMakefile();
|
||||||
cm.SetHomeDirectory("");
|
this->ReadCustomConfigurationFileTree(this->Impl->BinaryDir, mf);
|
||||||
cm.SetHomeOutputDirectory("");
|
|
||||||
cm.GetCurrentSnapshot().SetDefaultDefinitions();
|
|
||||||
cmGlobalGenerator gg(&cm);
|
|
||||||
cmMakefile mf(&gg, cm.GetCurrentSnapshot());
|
|
||||||
this->ReadCustomConfigurationFileTree(this->Impl->BinaryDir, &mf);
|
|
||||||
|
|
||||||
if (command) {
|
if (command.ShouldCreateNewTag()) {
|
||||||
if (command->ShouldCreateNewTag()) {
|
|
||||||
return this->CreateNewTag(quiet);
|
|
||||||
}
|
|
||||||
return this->ReadExistingTag(quiet);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this->Impl->Parts[PartStart]) {
|
|
||||||
return this->CreateNewTag(quiet);
|
return this->CreateNewTag(quiet);
|
||||||
}
|
}
|
||||||
|
return this->ReadExistingTag(quiet);
|
||||||
return this->ReadExistingTag(true) || this->CreateNewTag(quiet);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cmCTest::CreateNewTag(bool quiet)
|
bool cmCTest::CreateNewTag(bool quiet)
|
||||||
@@ -878,23 +863,41 @@ int cmCTest::ProcessSteps()
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this->Initialize(workDir, nullptr)) {
|
this->Impl->BinaryDir = workDir;
|
||||||
cmCTestLog(this, ERROR_MESSAGE,
|
cmSystemTools::ConvertToUnixSlashes(this->Impl->BinaryDir);
|
||||||
"Problem initializing the dashboard." << std::endl);
|
this->UpdateCTestConfiguration();
|
||||||
return 12;
|
this->BlockTestErrorDiagnostics();
|
||||||
}
|
|
||||||
|
|
||||||
int res = 0;
|
int res = 0;
|
||||||
cmCTestScriptHandler script;
|
cmCTestScriptHandler script;
|
||||||
script.SetCTestInstance(this);
|
script.SetCTestInstance(this);
|
||||||
script.CreateCMake();
|
script.CreateCMake();
|
||||||
cmMakefile& mf = *script.GetMakefile();
|
cmMakefile& mf = *script.GetMakefile();
|
||||||
|
this->ReadCustomConfigurationFileTree(this->Impl->BinaryDir, &mf);
|
||||||
this->SetCMakeVariables(mf);
|
this->SetCMakeVariables(mf);
|
||||||
std::vector<cmListFileArgument> args{
|
std::vector<cmListFileArgument> args{
|
||||||
cmListFileArgument("RETURN_VALUE", cmListFileArgument::Unquoted, 0),
|
cmListFileArgument("RETURN_VALUE", cmListFileArgument::Unquoted, 0),
|
||||||
cmListFileArgument("return_value", cmListFileArgument::Unquoted, 0),
|
cmListFileArgument("return_value", cmListFileArgument::Unquoted, 0),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (this->Impl->Parts[PartStart]) {
|
||||||
|
auto const func = cmListFileFunction(
|
||||||
|
"ctest_start", 0, 0,
|
||||||
|
{
|
||||||
|
{ this->GetTestModelString(), cmListFileArgument::Unquoted, 0 },
|
||||||
|
{ "GROUP", cmListFileArgument::Unquoted, 0 },
|
||||||
|
{ this->GetTestGroupString(), cmListFileArgument::Unquoted, 0 },
|
||||||
|
});
|
||||||
|
auto status = cmExecutionStatus(mf);
|
||||||
|
if (!mf.ExecuteCommand(func, status)) {
|
||||||
|
return 12;
|
||||||
|
}
|
||||||
|
} else if (!this->ReadExistingTag(true) && !this->CreateNewTag(false)) {
|
||||||
|
cmCTestLog(this, ERROR_MESSAGE,
|
||||||
|
"Problem initializing the dashboard." << std::endl);
|
||||||
|
return 12;
|
||||||
|
}
|
||||||
|
|
||||||
if (this->Impl->Parts[PartUpdate] &&
|
if (this->Impl->Parts[PartUpdate] &&
|
||||||
(this->GetRemainingTimeAllowed() > std::chrono::minutes(2))) {
|
(this->GetRemainingTimeAllowed() > std::chrono::minutes(2))) {
|
||||||
auto const func = cmListFileFunction("ctest_update", 0, 0, args);
|
auto const func = cmListFileFunction("ctest_update", 0, 0, args);
|
||||||
|
|||||||
@@ -69,13 +69,8 @@ public:
|
|||||||
/** Process Command line arguments */
|
/** Process Command line arguments */
|
||||||
int Run(std::vector<std::string> const& args);
|
int Run(std::vector<std::string> const& args);
|
||||||
|
|
||||||
/**
|
/** Initialize a dashboard run in the given build tree. */
|
||||||
* Initialize a dashboard run in the given build tree. The "command"
|
bool Initialize(const std::string& binary_dir, cmCTestStartCommand& command);
|
||||||
* argument is non-NULL when running from a command-driven (ctest_start)
|
|
||||||
* dashboard script, and NULL when running from the CTest command
|
|
||||||
* line.
|
|
||||||
*/
|
|
||||||
bool Initialize(const std::string& binary_dir, cmCTestStartCommand* command);
|
|
||||||
|
|
||||||
bool CreateNewTag(bool quiet);
|
bool CreateNewTag(bool quiet);
|
||||||
bool ReadExistingTag(bool quiet);
|
bool ReadExistingTag(bool quiet);
|
||||||
|
|||||||
Reference in New Issue
Block a user