CTest: Allow / to be in the build name, and be consistent with the build name

Prior to this change / was not allowed in the build name. This was tested
with a CDash server and worked. In addition the safe build name was not
used everywhere. This caused mismatched build names to be in the xml
files going to CDash which caused different rows to be created for the
same build.
This commit is contained in:
Bill Hoffman 2014-08-13 17:58:05 -04:00 committed by Brad King
parent 39b5df2f37
commit 653529ce55
4 changed files with 18 additions and 10 deletions

View File

@ -1479,8 +1479,10 @@ int cmCTestSubmitHandler::ProcessHandler()
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
std::string cmCTestSubmitHandler::GetSubmitResultsPrefix() std::string cmCTestSubmitHandler::GetSubmitResultsPrefix()
{ {
std::string buildname = cmCTest::SafeBuildIdField(
this->CTest->GetCTestConfiguration("BuildName"));
std::string name = this->CTest->GetCTestConfiguration("Site") + std::string name = this->CTest->GetCTestConfiguration("Site") +
"___" + this->CTest->GetCTestConfiguration("BuildName") + "___" + buildname +
"___" + this->CTest->GetCurrentTag() + "-" + "___" + this->CTest->GetCurrentTag() + "-" +
this->CTest->GetTestModelString() + "___XML___"; this->CTest->GetTestModelString() + "___XML___";
return name; return name;

View File

@ -258,12 +258,13 @@ int cmCTestUpdateHandler::ProcessHandler()
double elapsed_time_start = cmSystemTools::GetTime(); double elapsed_time_start = cmSystemTools::GetTime();
bool updated = vc->Update(); bool updated = vc->Update();
std::string buildname = cmCTest::SafeBuildIdField(
this->CTest->GetCTestConfiguration("BuildName"));
os << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" os << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
<< "<Update mode=\"Client\" Generator=\"ctest-" << "<Update mode=\"Client\" Generator=\"ctest-"
<< cmVersion::GetCMakeVersion() << "\">\n" << cmVersion::GetCMakeVersion() << "\">\n"
<< "\t<Site>" << this->CTest->GetCTestConfiguration("Site") << "</Site>\n" << "\t<Site>" << this->CTest->GetCTestConfiguration("Site") << "</Site>\n"
<< "\t<BuildName>" << this->CTest->GetCTestConfiguration("BuildName") << "\t<BuildName>" << buildname
<< "</BuildName>\n" << "</BuildName>\n"
<< "\t<BuildStamp>" << this->CTest->GetCurrentTag() << "-" << "\t<BuildStamp>" << this->CTest->GetCurrentTag() << "-"
<< this->CTest->GetTestModelString() << "</BuildStamp>" << std::endl; << this->CTest->GetTestModelString() << "</BuildStamp>" << std::endl;

View File

@ -44,14 +44,15 @@ int cmCTestUploadHandler::ProcessHandler()
"Cannot open Upload.xml file" << std::endl); "Cannot open Upload.xml file" << std::endl);
return -1; return -1;
} }
std::string buildname = cmCTest::SafeBuildIdField(
this->CTest->GetCTestConfiguration("BuildName"));
cmCTest::SetOfStrings::const_iterator it; cmCTest::SetOfStrings::const_iterator it;
ofs << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" ofs << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
<< "<?xml-stylesheet type=\"text/xsl\" " << "<?xml-stylesheet type=\"text/xsl\" "
"href=\"Dart/Source/Server/XSL/Build.xsl " "href=\"Dart/Source/Server/XSL/Build.xsl "
"<file:///Dart/Source/Server/XSL/Build.xsl> \"?>\n" "<file:///Dart/Source/Server/XSL/Build.xsl> \"?>\n"
<< "<Site BuildName=\"" << "<Site BuildName=\""
<< this->CTest->GetCTestConfiguration("BuildName") << buildname
<< "\" BuildStamp=\"" << "\" BuildStamp=\""
<< this->CTest->GetCurrentTag() << "-" << this->CTest->GetCurrentTag() << "-"
<< this->CTest->GetTestModelString() << "\" Name=\"" << this->CTest->GetTestModelString() << "\" Name=\""

View File

@ -489,7 +489,9 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command)
cmCTestLog(this, DEBUG, "Here: " << __LINE__ << std::endl); cmCTestLog(this, DEBUG, "Here: " << __LINE__ << std::endl);
cmCTestLog(this, OUTPUT, cmCTestLog(this, OUTPUT,
" Site: " << this->GetCTestConfiguration("Site") << std::endl " Site: " << this->GetCTestConfiguration("Site") << std::endl
<< " Build name: " << this->GetCTestConfiguration("BuildName") << " Build name: "
<< cmCTest::SafeBuildIdField(
this->GetCTestConfiguration("BuildName"))
<< std::endl); << std::endl);
cmCTestLog(this, DEBUG, "Produce XML is on" << std::endl); cmCTestLog(this, DEBUG, "Produce XML is on" << std::endl);
if ( this->TestModel == cmCTest::NIGHTLY && if ( this->TestModel == cmCTest::NIGHTLY &&
@ -1441,7 +1443,7 @@ std::string cmCTest::SafeBuildIdField(const std::string& value)
// Disallow non-filename and non-space whitespace characters. // Disallow non-filename and non-space whitespace characters.
// If they occur, replace them with "" // If they occur, replace them with ""
// //
const char *disallowed = "\\/:*?\"<>|\n\r\t\f\v"; const char *disallowed = "\\:*?\"<>|\n\r\t\f\v";
if (safevalue.find_first_of(disallowed) != value.npos) if (safevalue.find_first_of(disallowed) != value.npos)
{ {
@ -1582,12 +1584,14 @@ void cmCTest::EndXML(std::ostream& ostr)
int cmCTest::GenerateCTestNotesOutput(std::ostream& os, int cmCTest::GenerateCTestNotesOutput(std::ostream& os,
const cmCTest::VectorOfStrings& files) const cmCTest::VectorOfStrings& files)
{ {
std::string buildname = cmCTest::SafeBuildIdField(
this->GetCTestConfiguration("BuildName"));
cmCTest::VectorOfStrings::const_iterator it; cmCTest::VectorOfStrings::const_iterator it;
os << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" os << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
<< "<?xml-stylesheet type=\"text/xsl\" " << "<?xml-stylesheet type=\"text/xsl\" "
"href=\"Dart/Source/Server/XSL/Build.xsl " "href=\"Dart/Source/Server/XSL/Build.xsl "
"<file:///Dart/Source/Server/XSL/Build.xsl> \"?>\n" "<file:///Dart/Source/Server/XSL/Build.xsl> \"?>\n"
<< "<Site BuildName=\"" << this->GetCTestConfiguration("BuildName") << "<Site BuildName=\"" << buildname
<< "\" BuildStamp=\"" << "\" BuildStamp=\""
<< this->CurrentTag << "-" << this->GetTestModelString() << "\" Name=\"" << this->CurrentTag << "-" << this->GetTestModelString() << "\" Name=\""
<< this->GetCTestConfiguration("Site") << "\" Generator=\"ctest" << this->GetCTestConfiguration("Site") << "\" Generator=\"ctest"