浏览代码

Merge topic 'ExportTestLabelToJUnit'

2b99e64413 set_test_properties: link to the test properties in the documentation
b11e8afbfa ctest: export test labels to junit xml

Acked-by: Kitware Robot <[email protected]>
Acked-by: buildbot <[email protected]>
Merge-request: !8635
Brad King 2 年之前
父节点
当前提交
e49ff2b2f2
共有 2 个文件被更改,包括 16 次插入1 次删除
  1. 1 1
      Help/command/set_tests_properties.rst
  2. 15 0
      Source/CTest/cmCTestTestHandler.cxx

+ 1 - 1
Help/command/set_tests_properties.rst

@@ -20,4 +20,4 @@ See Also
 * :command:`add_test`
 * :command:`define_property`
 * the more general :command:`set_property` command
-* :ref:`Target Properties` for the list of properties known to CMake
+* :ref:`Test Properties` for the list of properties known to CMake

+ 15 - 0
Source/CTest/cmCTestTestHandler.cxx

@@ -2617,6 +2617,21 @@ bool cmCTestTestHandler::WriteJUnitXML()
       xml.EndElement(); // </failure>
     }
 
+    xml.StartElement("properties");
+    if ((result.Properties) && (!result.Properties->Labels.empty())) {
+      xml.StartElement("property");
+      xml.Attribute("name", "cmake_labels");
+      // Pass the property as a cmake-formatted list, consumers will know
+      // anyway that this information is coming from cmake, so it should
+      // be ok to put it here as a cmake-list.
+      xml.Attribute("value", cmList::to_string(result.Properties->Labels));
+      // if we export more properties, this should be done the same way,
+      // i.e. prefix the property name with "cmake_", and it it can be
+      // a list, write it cmake-formatted.
+      xml.EndElement(); // </property>
+    }
+    xml.EndElement(); // </properties>
+
     // Note: compressed test output is unconditionally disabled when
     // --output-junit is specified.
     xml.Element("system-out", result.Output);