From: "Darrick J. Wong" <djwong@kernel.org>
To: Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org, fstests@vger.kernel.org
Subject: Re: [PATCH] fstests: report: always save the dmesg as system-err if KEEP_DMESG is set
Date: Mon, 19 Dec 2022 09:39:33 -0800 [thread overview]
Message-ID: <Y6Ch1Qq9op2tmB1U@magnolia> (raw)
In-Reply-To: <20221216065121.30181-1-wqu@suse.com>
On Fri, Dec 16, 2022 at 02:51:21PM +0800, Qu Wenruo wrote:
> 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
Feel free to push back against the proliferation of config variables,
but perhaps this ought to be REPORT_DMESG={always,never,auto} ?
> - Using xunit reporting
> xunit-quite won't save the dmesg for passed test cases.
^^^^^ "quiet"?
> 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
Hmm. Does the junit xml schema[1] (that's what fstests implements, even
if we call it xunit, and even though there's a separate xunit[2] format
that is not the same!) actually allow us to have multiple <system-err>
elements?
For that matter, I look at things like this:
if [ -n "$quiet" ]; then
:
elif [ -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
elif [ -s "$outbad_file" ]; then
echo -e "\t\t<system-err>" >> $report
printf '<![CDATA[\n' >>$report
$diff "$out_src" "$outbad_file" | encode_xml >>$report
printf ']]>\n' >>$report
echo -e "\t\t</system-err>" >> $report
fi
and wonder why we prioritize recording dmesg output over .out.bad when
we could do both?
--D
[1] https://raw.githubusercontent.com/windyroad/JUnit-Schema/master/JUnit.xsd
[2] https://xunit.net/docs/format-xml-v2
> + fi
> + fi
> ;;
> "notrun")
> local notrun_file="${REPORT_DIR}/${test_name}.notrun"
> --
> 2.38.0
>
next prev parent reply other threads:[~2022-12-19 17:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-16 6:51 [PATCH] fstests: report: always save the dmesg as system-err if KEEP_DMESG is set Qu Wenruo
2022-12-19 17:39 ` Darrick J. Wong [this message]
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=Y6Ch1Qq9op2tmB1U@magnolia \
--to=djwong@kernel.org \
--cc=fstests@vger.kernel.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=wqu@suse.com \
/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