cmCTest: Add GetTestGroupString function

Rename the current GetTestModelString to GetTestGroupString, because
that is what the function actually returns.  Then add a new function
GetTestGroupString that actually returns the model.
This commit is contained in:
Daniel Pfeifer 2024-10-17 20:35:22 +02:00 committed by Brad King
parent 37651800ed
commit 402af107a5
6 changed files with 25 additions and 29 deletions

View File

@ -194,7 +194,7 @@ bool cmCTestStartCommand::InitialPass(std::vector<std::string> const& args,
return false;
}
cmCTestOptionalLog(this->CTest, OUTPUT,
" Use " << this->CTest->GetTestModelString() << " tag: "
" Use " << this->CTest->GetTestGroupString() << " tag: "
<< this->CTest->GetCurrentTag() << std::endl,
this->Quiet);
return true;

View File

@ -261,7 +261,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(
upload_as += "&stamp=";
upload_as += ctest_curl.Escape(this->CTest->GetCurrentTag());
upload_as += "-";
upload_as += ctest_curl.Escape(this->CTest->GetTestModelString());
upload_as += ctest_curl.Escape(this->CTest->GetTestGroupString());
cmCTestScriptHandler* ch = this->CTest->GetScriptHandler();
cmake* cm = ch->GetCMake();
if (cm) {
@ -570,18 +570,18 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file,
auto timeNow =
std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
str << "stamp=" << curl.Escape(this->CTest->GetCurrentTag()) << "-"
<< curl.Escape(this->CTest->GetTestModelString()) << "&"
<< "model=" << curl.Escape(this->CTest->GetTestModelString()) << "&"
<< curl.Escape(this->CTest->GetTestGroupString()) << "&"
<< "model=" << curl.Escape(this->CTest->GetTestGroupString()) << "&"
<< "build="
<< curl.Escape(this->CTest->GetCTestConfiguration("BuildName")) << "&"
<< "site=" << curl.Escape(this->CTest->GetCTestConfiguration("Site"))
<< "&"
<< "group=" << curl.Escape(this->CTest->GetTestModelString())
<< "group=" << curl.Escape(this->CTest->GetTestGroupString())
<< "&"
// For now, we send both "track" and "group" to CDash in case we're
// submitting to an older instance that still expects the prior
// terminology.
<< "track=" << curl.Escape(this->CTest->GetTestModelString()) << "&"
<< "track=" << curl.Escape(this->CTest->GetTestGroupString()) << "&"
<< "starttime=" << timeNow << "&"
<< "endtime=" << timeNow << "&"
<< "datafilesmd5[0]=" << md5sum << "&"
@ -892,7 +892,7 @@ std::string cmCTestSubmitHandler::GetSubmitResultsPrefix()
cmCTest::SafeBuildIdField(this->CTest->GetCTestConfiguration("BuildName"));
std::string name = this->CTest->GetCTestConfiguration("Site") + "___" +
buildname + "___" + this->CTest->GetCurrentTag() + "-" +
this->CTest->GetTestModelString() + "___XML___";
this->CTest->GetTestGroupString() + "___XML___";
return name;
}

View File

@ -195,7 +195,7 @@ int cmCTestUpdateHandler::ProcessHandler()
xml.Element("BuildName", buildname);
xml.Element("BuildStamp",
this->CTest->GetCurrentTag() + "-" +
this->CTest->GetTestModelString());
this->CTest->GetTestGroupString());
xml.Element("StartDateTime", start_time);
xml.Element("StartTime", start_time_time);
xml.Element("UpdateCommand", vc->GetUpdateCommandLine());

View File

@ -49,7 +49,7 @@ int cmCTestUploadHandler::ProcessHandler()
xml.Attribute("BuildName", buildname);
xml.Attribute("BuildStamp",
this->CTest->GetCurrentTag() + "-" +
this->CTest->GetTestModelString());
this->CTest->GetTestGroupString());
xml.Attribute("Name", this->CTest->GetCTestConfiguration("Site"));
xml.Attribute("Generator",
std::string("ctest-") + cmVersion::GetCMakeVersion());

View File

@ -498,7 +498,7 @@ bool cmCTest::CreateNewTag(bool quiet)
}
cmCTestOptionalLog(this, DEBUG,
"TestModel: " << this->GetTestModelString() << std::endl,
"TestModel: " << this->GetTestGroupString() << std::endl,
quiet);
cmCTestOptionalLog(
this, DEBUG, "TestModel: " << this->Impl->TestModel << std::endl, quiet);
@ -524,18 +524,8 @@ bool cmCTest::CreateNewTag(bool quiet)
cmsys::ofstream ofs(tagfile.c_str());
ofs << this->Impl->CurrentTag << std::endl;
ofs << this->GetTestGroupString() << std::endl;
ofs << this->GetTestModelString() << std::endl;
switch (this->Impl->TestModel) {
case cmCTest::EXPERIMENTAL:
ofs << "Experimental" << std::endl;
break;
case cmCTest::NIGHTLY:
ofs << "Nightly" << std::endl;
break;
case cmCTest::CONTINUOUS:
ofs << "Continuous" << std::endl;
break;
}
return true;
}
@ -603,7 +593,7 @@ bool cmCTest::ReadExistingTag(bool quiet)
cmCTestOptionalLog(this, OUTPUT,
" Use existing tag: " << tag << " - "
<< this->GetTestModelString()
<< this->GetTestGroupString()
<< std::endl,
quiet);
@ -1018,11 +1008,8 @@ int cmCTest::ProcessSteps()
return res;
}
std::string cmCTest::GetTestModelString()
std::string cmCTest::GetTestModelString() const
{
if (!this->Impl->SpecificGroup.empty()) {
return this->Impl->SpecificGroup;
}
switch (this->Impl->TestModel) {
case cmCTest::NIGHTLY:
return "Nightly";
@ -1032,6 +1019,14 @@ std::string cmCTest::GetTestModelString()
return "Experimental";
}
std::string cmCTest::GetTestGroupString() const
{
if (!this->Impl->SpecificGroup.empty()) {
return this->Impl->SpecificGroup;
}
return this->GetTestModelString();
}
int cmCTest::GetTestModelFromString(const std::string& str)
{
if (str.empty()) {
@ -1208,7 +1203,7 @@ void cmCTest::StartXML(cmXMLWriter& xml, bool append)
std::string buildname =
cmCTest::SafeBuildIdField(this->GetCTestConfiguration("BuildName"));
std::string stamp = cmCTest::SafeBuildIdField(this->Impl->CurrentTag + "-" +
this->GetTestModelString());
this->GetTestGroupString());
std::string site =
cmCTest::SafeBuildIdField(this->GetCTestConfiguration("Site"));
@ -1334,7 +1329,7 @@ int cmCTest::GenerateCTestNotesOutput(cmXMLWriter& xml,
xml.StartElement("Site");
xml.Attribute("BuildName", buildname);
xml.Attribute("BuildStamp",
this->Impl->CurrentTag + "-" + this->GetTestModelString());
this->Impl->CurrentTag + "-" + this->GetTestGroupString());
xml.Attribute("Name", this->GetCTestConfiguration("Site"));
xml.Attribute("Generator",
std::string("ctest-") + cmVersion::GetCMakeVersion());

View File

@ -136,7 +136,8 @@ public:
void SetTestModel(int mode);
int GetTestModel() const;
std::string GetTestModelString();
std::string GetTestModelString() const;
std::string GetTestGroupString() const;
static int GetTestModelFromString(const std::string& str);
static std::string CleanString(const std::string& str,
std::string::size_type spos = 0);