diff options
author | Alex Neundorf <neundorf@kde.org> | 2023-07-17 20:47:53 (GMT) |
---|---|---|
committer | Alex Neundorf <neundorf@kde.org> | 2023-07-26 20:58:35 (GMT) |
commit | b11e8afbfafde5ab70b796b664d82b2684dd272e (patch) | |
tree | 6810fdbf66699961a013fd7648dae3c1756ce676 /Source | |
parent | 8086ce2706dcbbea5d9ead0222666f2004826c53 (diff) | |
download | CMake-b11e8afbfafde5ab70b796b664d82b2684dd272e.zip CMake-b11e8afbfafde5ab70b796b664d82b2684dd272e.tar.gz CMake-b11e8afbfafde5ab70b796b664d82b2684dd272e.tar.bz2 |
ctest: export test labels to junit xml
With this patch, the junit files written by ctest also contain the
test labels as testcase properties, see
https://github.com/testmoapp/junitxml#properties
The name for the property is "cmake_labels", where "cmake_"
is used namespace-like. This could be done the same way
if we export more properties to junit.
Also this makes it clear to consumers that this is coming
from cmake, and the list is a cmake-formatted string.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CTest/cmCTestTestHandler.cxx | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 6b02a5e..5ac696b 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/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); |