From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org, fstests@vger.kernel.org
Subject: [PATCH] fstests: report: always save the dmesg as system-err if KEEP_DMESG is set
Date: Fri, 16 Dec 2022 14:51:21 +0800 [thread overview]
Message-ID: <20221216065121.30181-1-wqu@suse.com> (raw)
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@suse.com>
---
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
next reply other threads:[~2022-12-16 6:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-16 6:51 Qu Wenruo [this message]
2022-12-19 17:39 ` [PATCH] fstests: report: always save the dmesg as system-err if KEEP_DMESG is set Darrick J. Wong
2022-12-19 18:56 ` Theodore Ts'o
2022-12-19 22:45 ` Qu Wenruo
2022-12-19 23:49 ` Theodore Ts'o
2022-12-20 0:55 ` Qu Wenruo
2022-12-19 22:54 ` Qu Wenruo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221216065121.30181-1-wqu@suse.com \
--to=wqu@suse.com \
--cc=fstests@vger.kernel.org \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox