On Mon, Jun 20, 2022 at 09:29:32PM +0200, David Disseldorp wrote: > 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. Thanks for fixing it. So the n_total of xunit report is wrong. I think this change won't affect anyone's regular testing, but just notice that if someone use the xunit report, especially depends on the n_total number. Reviewed-by: Zorro Lang <zlang@xxxxxxxxxx> > > Signed-off-by: David Disseldorp <ddiss@xxxxxxx> > --- > 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 >