ENH: add subproject tag property for ctest

This commit is contained in:
Bill Hoffman 2009-01-09 12:05:23 -05:00
parent 86b103f271
commit ed387ffe6b
3 changed files with 44 additions and 9 deletions

View File

@ -110,7 +110,7 @@ public:
void CreateCMake(); void CreateCMake();
void GetCommandDocumentation(std::vector<cmDocumentationEntry>& v) const; void GetCommandDocumentation(std::vector<cmDocumentationEntry>& v) const;
cmake* GetCMake() { return this->CMake;}
private: private:
// reads in a script // reads in a script
int ReadInScript(const std::string& total_script_arg); int ReadInScript(const std::string& total_script_arg);

View File

@ -1309,8 +1309,39 @@ void cmCTest::StartXML(std::ostream& ostr)
<< "\tProcessorClockFrequency=\"" << "\tProcessorClockFrequency=\""
<< info.GetProcessorClockFrequency() << "\"\n" << info.GetProcessorClockFrequency() << "\"\n"
<< ">" << std::endl; << ">" << std::endl;
this->AddSiteProperties(ostr);
} }
//----------------------------------------------------------------------
void cmCTest::AddSiteProperties(std::ostream& ostr)
{
cmCTestScriptHandler* ch =
static_cast<cmCTestScriptHandler*>(this->GetHandler("script"));
const char* subproject =
ch->GetCMake()->GetProperty("SubProject", cmProperty::GLOBAL);
if(subproject)
{
ostr << "<Subproject name=\"" << subproject << "\">\n";
const char* labels =
ch->GetCMake()->GetProperty("SubProjectLabels", cmProperty::GLOBAL);
if(labels)
{
ostr << " <Labels>\n";
std::string l = labels;
std::vector<std::string> args;
cmSystemTools::ExpandListArgument(l, args);
for(std::vector<std::string>::iterator i = args.begin();
i != args.end(); ++i)
{
ostr << " <Label>" << i->c_str() << "</Label>\n";
}
ostr << " </Labels>\n";
}
ostr << "</Subproject>\n";
}
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void cmCTest::EndXML(std::ostream& ostr) void cmCTest::EndXML(std::ostream& ostr)
{ {
@ -1323,16 +1354,17 @@ int cmCTest::GenerateCTestNotesOutput(std::ostream& os,
{ {
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=\"" << this->GetCTestConfiguration("BuildName")
<< "\" BuildStamp=\"" << "\" BuildStamp=\""
<< this->CurrentTag << "-" << this->GetTestModelString() << "\" Name=\"" << this->CurrentTag << "-" << this->GetTestModelString() << "\" Name=\""
<< this->GetCTestConfiguration("Site") << "\" Generator=\"ctest" << this->GetCTestConfiguration("Site") << "\" Generator=\"ctest"
<< cmVersion::GetCMakeVersion() << cmVersion::GetCMakeVersion()
<< "\">\n" << "\">\n";
<< "<Notes>" << std::endl; this->AddSiteProperties(os);
os << "<Notes>" << std::endl;
for ( it = files.begin(); it != files.end(); it ++ ) for ( it = files.begin(); it != files.end(); it ++ )
{ {

View File

@ -27,6 +27,7 @@ class cmMakefile;
class cmCTestGenericHandler; class cmCTestGenericHandler;
class cmGeneratedFileStream; class cmGeneratedFileStream;
class cmCTestCommand; class cmCTestCommand;
class cmCTestScriptHandler;
#define cmCTestLog(ctSelf, logType, msg) \ #define cmCTestLog(ctSelf, logType, msg) \
do { \ do { \
@ -171,6 +172,7 @@ public:
///! The max output width ///! The max output width
int GetMaxTestNameWidth() const; int GetMaxTestNameWidth() const;
int SetMaxTestNameWidth(int w) { this->MaxTestNameWidth = w;}
/** /**
* Run a single executable command and put the stdout and stderr * Run a single executable command and put the stdout and stderr
@ -335,6 +337,7 @@ public:
/** Direct process output to given streams. */ /** Direct process output to given streams. */
void SetStreams(std::ostream* out, std::ostream* err) void SetStreams(std::ostream* out, std::ostream* err)
{ this->StreamOut = out; this->StreamErr = err; } { this->StreamOut = out; this->StreamErr = err; }
void AddSiteProperties(std::ostream& );
private: private:
std::string ConfigType; std::string ConfigType;
bool Verbose; bool Verbose;