[PATCH 07/14] report: encode the kernel log as a separate xml element

Darrick J. Wong
2023-02-15T01:46:25Z

Record the .dmesg file in a new <kernel-log> element instead of
multiplexing it with <system-err>. This means that the xml report can
now capture kernel log and bad golden output.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
common/report | 11 +++++------
doc/xunit.xsd | 14 ++++++++++++--
2 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/common/report b/common/report
index eb169175bc..2e5959312a 100644
--- a/common/report
+++ b/common/report
@@ -137,15 +137,14 @@ _xunit_make_testcase_report()
printf ']]>\n' >>$report
echo -e "\t\t</system-out>" >> $report
fi
- if [ -n "$quiet" ]; then
- :
- elif [ -f "$dmesg_file" ]; then
- echo -e "\t\t<system-err>" >> $report
+ if [ -z "$quiet" -a -f "$dmesg_file" ]; then
+ echo -e "\t\t<kernel-log>" >> $report
printf ' \n' >>$report
cat "$dmesg_file" | tr -dc '[:print:][:space:]' | encode_cdata >>$report
printf ']]>\n' >>$report
- echo -e "\t\t</system-err>" >> $report
- elif [ -s "$outbad_file" ]; then
+ echo -e "\t\t</kernel-log>" >> $report
+ fi
+ if [ -z "$quiet" -a -s "$outbad_file" ]; then
echo -e "\t\t<system-err>" >> $report
printf ' \n' >>$report
$diff "$out_src" "$outbad_file" | encode_cdata >>$report
diff --git a/doc/xunit.xsd b/doc/xunit.xsd
index 3ed72f2f86..d287eaf5a2 100644
--- a/doc/xunit.xsd
+++ b/doc/xunit.xsd
@@ -131,7 +131,7 @@
</xs:complexType>
</xs:element>
</xs:choice>
- <xs:choice minOccurs="0" maxOccurs="2">
+ <xs:choice minOccurs="0" maxOccurs="3">
<xs:element name="system-out" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation xml:lang="en">Data that was written to the .full log file while the test was executed.</xs:documentation>
@@ -144,7 +144,17 @@
</xs:element>
<xs:element name="system-err" minOccurs="0" maxOccurs="1">
<xs:annotation>
- <xs:documentation xml:lang="en">Kernel log or data that was compared to the golden output file after the test was executed.</xs:documentation>
+ <xs:documentation xml:lang="en">Data that was compared to the golden output file after the test was executed.</xs:documentation>
+ </xs:annotation>
+ <xs:simpleType>
+ <xs:restriction base="pre-string">
+ <xs:whiteSpace value="preserve"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+ <xs:element name="kernel-log" minOccurs="0" maxOccurs="1">
+ <xs:annotation>
+ <xs:documentation xml:lang="en">Kernel log recorded while the test was executed.</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="pre-string">