When KEEP_DMESG is set to "yes", we will always save the dmesg of any test case (no matter if it passed or not) into "$seqnum.dmesg". But this KEEP_DMESG behavior doesn't affect xunit report. This patch will make xunit report to follow KEEP_DMESG setting. Since error is checked by testcase.failure attribute, this new <system-err> section should not cause the existing parsers to treat passed cases as errors. KEEP_DMESG is only followed if all the following conditions are met: - KEEP_DMESG is set to yes - Using xunit reporting xunit-quite won't save the dmesg for passed test cases. This extra saved dmesg would definitely boost the xml size, but if the end user wants to save all the dmesg (for later verification), then I'd say it's a unavoidable cost. Signed-off-by: Qu Wenruo <wqu@xxxxxxxx> --- common/report | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/common/report b/common/report index 64f9c866..4a747f8d 100644 --- a/common/report +++ b/common/report @@ -87,6 +87,19 @@ _xunit_make_testcase_report() echo -e "\t<testcase classname=\"xfstests.$sect_name\" name=\"$test_name\" time=\"$test_time\">" >> $report case $test_status in "pass") + # If we have KEEP_DMESG and want full output, also save the + # dmesg into the passed result + if [ "$KEEP_DMESG" == yes -a "$quiet" != "yes" ]; then + local dmesg_file="${REPORT_DIR}/${test_name}.dmesg" + if [ -f "$dmesg_file" ]; then + echo -e "\t\t<system-err>" >> $report + printf '<![CDATA[\n' >>$report + cat "$dmesg_file" | tr -dc '[:print:][:space:]' | \ + encode_xml >>$report + printf ']]>\n' >>$report + echo -e "\t\t</system-err>" >> $report + fi + fi ;; "notrun") local notrun_file="${REPORT_DIR}/${test_name}.notrun" -- 2.38.0