Переглянути джерело

ENH: add subproject tag property for ctest

Bill Hoffman 17 роки тому
батько
коміт
ed387ffe6b
3 змінених файлів з 44 додано та 9 видалено
  1. 1 1
      Source/CTest/cmCTestScriptHandler.h
  2. 40 8
      Source/cmCTest.cxx
  3. 3 0
      Source/cmCTest.h

+ 1 - 1
Source/CTest/cmCTestScriptHandler.h

@@ -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);

+ 40 - 8
Source/cmCTest.cxx

@@ -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")
-    << "\" BuildStamp=\""
-    << this->CurrentTag << "-" << this->GetTestModelString() << "\" Name=\""
-    << this->GetCTestConfiguration("Site") << "\" Generator=\"ctest"
-    << cmVersion::GetCMakeVersion()
-    << "\">\n"
-    << "<Notes>" << std::endl;
+     << "<Site BuildName=\"" << this->GetCTestConfiguration("BuildName")
+     << "\" BuildStamp=\""
+     << this->CurrentTag << "-" << this->GetTestModelString() << "\" Name=\""
+     << this->GetCTestConfiguration("Site") << "\" Generator=\"ctest"
+     << cmVersion::GetCMakeVersion()
+     << "\">\n";
+  this->AddSiteProperties(os);
+  os << "<Notes>" << std::endl;
 
 
   for ( it = files.begin(); it != files.end(); it ++ )
   for ( it = files.begin(); it != files.end(); it ++ )
     {
     {

+ 3 - 0
Source/cmCTest.h

@@ -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;