linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: djwong@kernel.org, guaneryu@gmail.com, zlang@redhat.com
Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me
Subject: [PATCH 2/2] check: optionally compress core dumps
Date: Wed, 05 Oct 2022 15:31:21 -0700	[thread overview]
Message-ID: <166500908117.887104.12652015559068296578.stgit@magnolia> (raw)
In-Reply-To: <166500906990.887104.14293889638885406232.stgit@magnolia>

From: Darrick J. Wong <djwong@kernel.org>

Compress coredumps whenever desired to save space.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 README    |    1 +
 common/rc |   13 +++++++++++++
 2 files changed, 14 insertions(+)


diff --git a/README b/README
index 80d148be82..ec923ca564 100644
--- a/README
+++ b/README
@@ -241,6 +241,7 @@ Misc:
    this option is supported for all filesystems currently only -overlay is
    expected to run without issues. For other filesystems additional patches
    and fixes to the test suite might be needed.
+ - Set COMPRESS_COREDUMPS=1 to compress core dumps with gzip -9.
 
 ______________________
 USING THE FSQA SUITE
diff --git a/common/rc b/common/rc
index 9750d06a9a..d3af4e07b2 100644
--- a/common/rc
+++ b/common/rc
@@ -4955,12 +4955,25 @@ _save_coredump()
 	local core_hash="$(_md5_checksum "$path")"
 	local out_file="$RESULT_BASE/$seqnum.core.$core_hash"
 
+	if [ "$COMPRESS_COREDUMPS" = "1" ]; then
+		out_file="${out_file}.gz"
+	fi
+
 	if [ -s "$out_file" ]; then
 		rm -f "$path"
 		return
 	fi
 	rm -f "$out_file"
 
+	if [ "$COMPRESS_COREDUMPS" = "1" ]; then
+		if gzip -9 < "$path" > "$out_file"; then
+			rm -f "$path"
+		else
+			rm -f "$out_file"
+		fi
+		return
+	fi
+
 	mv "$path" "$out_file"
 }
 


  parent reply	other threads:[~2022-10-05 22:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-05 22:31 [PATCHSET 0/2] fstests: improve coredump capture and storage Darrick J. Wong
2022-10-05 22:31 ` [PATCH 1/2] check: detect and preserve all coredumps made by a test Darrick J. Wong
2022-10-07  5:18   ` Zorro Lang
2022-10-07 21:29     ` Darrick J. Wong
2022-10-05 22:31 ` Darrick J. Wong [this message]
2022-10-07 12:45   ` [PATCH 2/2] check: optionally compress core dumps Zorro Lang
2022-10-07 21:32     ` Darrick J. Wong
2022-10-12  1:45 [PATCHSET v2 0/2] fstests: improve coredump capture and storage Darrick J. Wong
2022-10-12  1:45 ` [PATCH 2/2] check: optionally compress core dumps Darrick J. Wong
2022-10-13 11:51   ` Zorro Lang
2022-10-13 15:50     ` Darrick J. Wong

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=166500908117.887104.12652015559068296578.stgit@magnolia \
    --to=djwong@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=guan@eryu.me \
    --cc=guaneryu@gmail.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=zlang@redhat.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;
as well as URLs for NNTP newsgroup(s).