From ed387ffe6b72986856ca1f14c9ac11c4e12c5d6b Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Fri, 9 Jan 2009 12:05:23 -0500 Subject: [PATCH] ENH: add subproject tag property for ctest --- Source/CTest/cmCTestScriptHandler.h | 2 +- Source/cmCTest.cxx | 48 ++++++++++++++++++++++++----- Source/cmCTest.h | 3 ++ 3 files changed, 44 insertions(+), 9 deletions(-) diff --git a/Source/CTest/cmCTestScriptHandler.h b/Source/CTest/cmCTestScriptHandler.h index d410c4e0d..ba59a3342 100644 --- a/Source/CTest/cmCTestScriptHandler.h +++ b/Source/CTest/cmCTestScriptHandler.h @@ -110,7 +110,7 @@ public: void CreateCMake(); void GetCommandDocumentation(std::vector& v) const; - + cmake* GetCMake() { return this->CMake;} private: // reads in a script int ReadInScript(const std::string& total_script_arg); diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 15f117889..cbead3c5b 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -1309,8 +1309,39 @@ void cmCTest::StartXML(std::ostream& ostr) << "\tProcessorClockFrequency=\"" << info.GetProcessorClockFrequency() << "\"\n" << ">" << std::endl; + this->AddSiteProperties(ostr); } +//---------------------------------------------------------------------- +void cmCTest::AddSiteProperties(std::ostream& ostr) +{ + cmCTestScriptHandler* ch = + static_cast(this->GetHandler("script")); + const char* subproject = + ch->GetCMake()->GetProperty("SubProject", cmProperty::GLOBAL); + if(subproject) + { + ostr << "\n"; + const char* labels = + ch->GetCMake()->GetProperty("SubProjectLabels", cmProperty::GLOBAL); + if(labels) + { + ostr << " \n"; + std::string l = labels; + std::vector args; + cmSystemTools::ExpandListArgument(l, args); + for(std::vector::iterator i = args.begin(); + i != args.end(); ++i) + { + ostr << " \n"; + } + ostr << " \n"; + } + ostr << "\n"; + } +} + + //---------------------------------------------------------------------- void cmCTest::EndXML(std::ostream& ostr) { @@ -1323,16 +1354,17 @@ int cmCTest::GenerateCTestNotesOutput(std::ostream& os, { cmCTest::VectorOfStrings::const_iterator it; os << "\n" - << " \"?>\n" - << "GetCTestConfiguration("BuildName") - << "\" BuildStamp=\"" - << this->CurrentTag << "-" << this->GetTestModelString() << "\" Name=\"" - << this->GetCTestConfiguration("Site") << "\" Generator=\"ctest" - << cmVersion::GetCMakeVersion() - << "\">\n" - << "" << std::endl; + << "GetCTestConfiguration("BuildName") + << "\" BuildStamp=\"" + << this->CurrentTag << "-" << this->GetTestModelString() << "\" Name=\"" + << this->GetCTestConfiguration("Site") << "\" Generator=\"ctest" + << cmVersion::GetCMakeVersion() + << "\">\n"; + this->AddSiteProperties(os); + os << "" << std::endl; for ( it = files.begin(); it != files.end(); it ++ ) { diff --git a/Source/cmCTest.h b/Source/cmCTest.h index 10a7d5b09..adfafdfb0 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -27,6 +27,7 @@ class cmMakefile; class cmCTestGenericHandler; class cmGeneratedFileStream; class cmCTestCommand; +class cmCTestScriptHandler; #define cmCTestLog(ctSelf, logType, msg) \ do { \ @@ -171,6 +172,7 @@ public: ///! The max output width int GetMaxTestNameWidth() const; + int SetMaxTestNameWidth(int w) { this->MaxTestNameWidth = w;} /** * Run a single executable command and put the stdout and stderr @@ -335,6 +337,7 @@ public: /** Direct process output to given streams. */ void SetStreams(std::ostream* out, std::ostream* err) { this->StreamOut = out; this->StreamErr = err; } + void AddSiteProperties(std::ostream& ); private: std::string ConfigType; bool Verbose;