From: David Disseldorp <ddiss@suse.de>
To: fstests@vger.kernel.org
Cc: David Disseldorp <ddiss@suse.de>
Subject: [PATCH 4/6] report: fix xunit tests count
Date: Mon, 20 Jun 2022 21:29:32 +0200 [thread overview]
Message-ID: <20220620192934.21694-5-ddiss@suse.de> (raw)
In-Reply-To: <20220620192934.21694-1-ddiss@suse.de>
The xunit "section report" provides a tests attribute, which according
to https://llg.cubic.org/docs/junit/ represents:
tests="" <!-- The total number of tests in the suite, required. -->
The current value is generated as a sum of the $n_try and $n_notrun
counters. This is incorrect as the $n_try counter already includes tests
which are run but complete with _notrun.
One special case exists for $showme (check -n), where $n_try remains
zero, so $n_notrun can be used as-is.
Signed-off-by: David Disseldorp <ddiss@suse.de>
---
check | 13 ++++++-------
common/report | 14 +++++++++-----
2 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/check b/check
index 43c072d2..a5183d3a 100755
--- a/check
+++ b/check
@@ -430,13 +430,12 @@ _wrapup()
seq="check"
check="$RESULT_BASE/check"
- if $showme; then
- if $needwrap; then
- if $do_report; then
- _make_section_report
- fi
- needwrap=false
+ if $showme && $needwrap; then
+ if $do_report; then
+ # $showme = all selected tests are notrun (no tries)
+ _make_section_report "$n_notrun" "0" "$n_notrun"
fi
+ needwrap=false
elif $needwrap; then
if [ -f $check.time -a -f $tmp.time ]; then
cat $check.time $tmp.time \
@@ -495,7 +494,7 @@ _wrapup()
fi
echo "" >>$tmp.summary
if $do_report; then
- _make_section_report
+ _make_section_report "$n_try" "$n_bad" "$n_notrun"
fi
needwrap=false
fi
diff --git a/common/report b/common/report
index bf05afa9..84d9e0a7 100644
--- a/common/report
+++ b/common/report
@@ -49,9 +49,11 @@ _xunit_add_property()
_xunit_make_section_report()
{
# xfstest:section ==> xunit:testsuite
+ local tests_count="$1"
+ local bad_count="$2"
+ local notrun_count="$3"
local sect_name=$section
local sect_time=`expr $sect_stop - $sect_start`
- local n_total=`expr $n_try + $n_notrun`
if [ $sect_name == '-no-sections-' ]; then
sect_name='global'
@@ -62,9 +64,8 @@ _xunit_make_section_report()
if [ -z "$date_time" ]; then
date_time=$(date +"%F %T")
fi
- local dtime=`echo $date_time| tr " " 'T'`
- local stats="failures=\"$n_bad\" skipped=\"$n_notrun\" tests=\"$n_total\" time=\"$sect_time\""
- local hw_info="hostname=\"$HOST\" timestamp=\"$dtime\" "
+ local stats="failures=\"$bad_count\" skipped=\"$notrun_count\" tests=\"$tests_count\" time=\"$sect_time\""
+ local hw_info="hostname=\"$HOST\" timestamp=\"${date_time/ /T}\" "
echo "<testsuite name=\"xfstests\" $stats $hw_info >" >> $REPORT_DIR/result.xml
# Properties
@@ -149,10 +150,13 @@ _xunit_make_testcase_report()
# Common report generator entry points
_make_section_report()
{
+ local tests_count="$1"
+ local bad_count="$2"
+ local notrun_count="$3"
for report in $REPORT_LIST; do
case "$report" in
"xunit")
- _xunit_make_section_report
+ _xunit_make_section_report "$tests_count" "$bad_count" "$notrun_count"
;;
*)
_dump_err "format '$report' is not supported"
--
2.35.3
next prev parent reply other threads:[~2022-06-20 19:30 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-20 19:29 [PATCH 0/6] check: minor cleanups and xunit report fix David Disseldorp
2022-06-20 19:29 ` [PATCH 1/6] check: avoid FSTYP=<fstyp parameter> repetition David Disseldorp
2022-06-22 4:27 ` Zorro Lang
2022-06-20 19:29 ` [PATCH 2/6] check: simplify check.time parsing David Disseldorp
2022-06-22 4:31 ` Zorro Lang
2022-06-20 19:29 ` [PATCH 3/6] report: drop unused _xunit_make_section_report parameter David Disseldorp
2022-06-22 4:37 ` Zorro Lang
2022-06-20 19:29 ` David Disseldorp [this message]
2022-06-22 5:03 ` [PATCH 4/6] report: fix xunit tests count Zorro Lang
2022-06-20 19:29 ` [PATCH 5/6] check: use arrays instead of separate n_ counters David Disseldorp
2022-06-22 5:11 ` Zorro Lang
2022-06-20 19:29 ` [PATCH 6/6] check: remove err and first_test variables David Disseldorp
2022-06-22 5:15 ` Zorro Lang
2022-06-22 5:21 ` [PATCH 0/6] check: minor cleanups and xunit report fix Zorro Lang
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=20220620192934.21694-5-ddiss@suse.de \
--to=ddiss@suse.de \
--cc=fstests@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.