FS/XFS testing framework
 help / color / mirror / Atom feed
From: David Disseldorp <ddiss@suse.de>
To: fstests@vger.kernel.org
Cc: David Disseldorp <ddiss@suse.de>
Subject: [PATCH 2/2] report: add xunit-gzip report type
Date: Mon, 14 Sep 2026 23:46:12 +1000	[thread overview]
Message-ID: <20260914140710.111641-3-ddiss@suse.de> (raw)
In-Reply-To: <20260914140710.111641-1-ddiss@suse.de>

xunit xml output is quite compressible, so provide an option to do it
during report generation.

Signed-off-by: David Disseldorp <ddiss@suse.de>
---
 check         |  2 +-
 common/report | 18 ++++++++++++++----
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/check b/check
index bca30215..eba515bc 100755
--- a/check
+++ b/check
@@ -74,7 +74,7 @@ General options:
     -S section              exclude the specified section from the config file
     -T                      output timestamps
     -R fmt[,fmt]            generate report in formats specified. Supported
-                              formats: xunit, xunit-quiet
+                              formats: xunit, xunit-quiet, xunit-gzip
     --exact-order           run tests in the exact order specified
     --extra-space <size>    require minimum free space on scratch device
     --fs <type>             test the given FSTYP; valid types include:
diff --git a/common/report b/common/report
index eff01a7f..3aa8dcc2 100644
--- a/common/report
+++ b/common/report
@@ -110,6 +110,7 @@ _xunit_make_section_report()
 	local bad_count="$3"
 	local notrun_count="$4"
 	local sect_time="$5"
+	local report_format="$6"
 	local timestamp
 	local tmp_fn="$REPORT_DIR/result.xml.new"
 	local out_fn="$REPORT_DIR/result.xml"
@@ -158,7 +159,13 @@ ENDL
 		cat $report >> "$tmp_fn"
 	fi
 	echo "</testsuite>" >> "$tmp_fn"
-	_sync_fs "$tmp_fn" && mv "$tmp_fn" "$out_fn"
+	_sync_fs "$tmp_fn" || return
+	if [ "$report_format" = "xunit-gzip" ]; then
+		out_fn="${out_fn}.gz"
+		"$GZIP_PROG" --stdout "$tmp_fn" > "$out_fn" && rm -f "$tmp_fn"
+	else
+		mv "$tmp_fn" "$out_fn"
+	fi
 	echo "Xunit report: $out_fn"
 }
 
@@ -260,10 +267,10 @@ _make_section_report()
 	local sect_time="$5"
 	for report in $REPORT_LIST; do
 		case "$report" in
-		"xunit"|"xunit-quiet")
+		"xunit"|"xunit-quiet"|"xunit-gzip")
 			_xunit_make_section_report "$sect_name" "$tests_count" \
 						   "$bad_count" "$notrun_count" \
-						   "$sect_time"
+						   "$sect_time" "$report"
 			;;
 		*)
 			_dump_err "format '$report' is not supported"
@@ -280,7 +287,7 @@ _make_testcase_report()
 	local test_time="$4"
 	for report in $REPORT_LIST; do
 		case "$report" in
-		"xunit"|"xunit-quiet")
+		"xunit"|"xunit-quiet"|"xunit-gzip")
 			_xunit_make_testcase_report "$sect_name" "$test_seq" \
 						    "$test_status" "$test_time" "$report"
 			;;
@@ -296,6 +303,9 @@ _assert_report_list() {
 		case "$report" in
 		"xunit"|"xunit-quiet")
 			;;
+		"xunit-gzip")
+			[ -x "$GZIP_PROG" ] || _fatal "'$report' requires gzip"
+			;;
 		*)
 			_fatal "report format '$report' is not supported"
 			;;
-- 
2.55.0


      parent reply	other threads:[~2026-09-14 14:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-14 13:46 [PATCH 0/2] report: optionally gzip xunit output David Disseldorp
2026-09-14 13:46 ` [PATCH 1/2] report: put failure cdata collection in a helper fn David Disseldorp
2026-09-14 13:46 ` David Disseldorp [this message]

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=20260914140710.111641-3-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox