ENH: Teach CTest to submit test property LABELS

This teaches CTest to send the test property "LABELS" in Test.xml
dashboard submissions as Label elements inside a Labels element.
This commit is contained in:
Brad King 2009-01-07 10:41:37 -05:00
parent 605f4bd34e
commit 377bebb910
3 changed files with 46 additions and 1 deletions

View File

@ -1224,6 +1224,14 @@ void cmCTestTestHandler::LoadTestList()
cmSystemTools::GetLineFromStream(fin, line);
p.Environment.push_back(line);
}
int numLabels = 0;
ok = ok && this->GetValue("Labels:",
numLabels, fin);
for(int j =0; j < numLabels; j++)
{
cmSystemTools::GetLineFromStream(fin, line);
p.Labels.push_back(line);
}
if(!ok)
{
cmCTestLog(this->CTest, ERROR_MESSAGE,
@ -1316,6 +1324,13 @@ std::string cmCTestTestHandler::SaveTestList()
{
fout << *e << "\n";
}
fout << "Labels:\n" <<
p.Labels.size() << "\n";
for(std::vector<std::string>::const_iterator e =
p.Labels.begin(); e != p.Labels.end(); ++e)
{
fout << *e << "\n";
}
}
fout.close();
return fname;
@ -1513,7 +1528,21 @@ void cmCTestTestHandler::GenerateDartOutput(std::ostream& os)
os
<< "</Value>\n"
<< "\t\t\t</Measurement>\n"
<< "\t\t</Results>\n"
<< "\t\t</Results>\n";
if(!result->Properties->Labels.empty())
{
os << "\t\t<Labels>\n";
std::vector<std::string> const& labels = result->Properties->Labels;
for(std::vector<std::string>::const_iterator li = labels.begin();
li != labels.end(); ++li)
{
os << "\t\t\t<Label>" << cmCTest::MakeXMLSafe(*li) << "</Label>\n";
}
os << "\t\t</Labels>\n";
}
os
<< "\t</Test>" << std::endl;
}
@ -2306,6 +2335,16 @@ bool cmCTestTestHandler::SetTestsProperties(
rtit->Environment.push_back(*crit);
}
}
if ( key == "LABELS" )
{
std::vector<std::string> lval;
cmSystemTools::ExpandListArgument(val.c_str(), lval);
std::vector<std::string>::iterator crit;
for ( crit = lval.begin(); crit != lval.end(); ++ crit )
{
rtit->Labels.push_back(*crit);
}
}
if ( key == "MEASUREMENT" )
{
size_t pos = val.find_first_of("=");

View File

@ -95,6 +95,7 @@ public:
double Timeout;
int Index;
std::vector<std::string> Environment;
std::vector<std::string> Labels;
};
struct cmCTestTestResult

View File

@ -109,6 +109,11 @@ void cmTest::DefineProperties(cmake *cm)
"specified regular expressions, the test will fail."
"For example: PASS_REGULAR_EXPRESSION \"[^a-z]Error;ERROR;Failed\"");
cm->DefineProperty
("LABELS", cmProperty::TEST,
"Specify a list of text labels associated with a test.",
"The list is reported in dashboard submissions.");
cm->DefineProperty
("MEASUREMENT", cmProperty::TEST,
"Specify a DART measurement and value to be reported for a test.",