All of lore.kernel.org
 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: Tue, 11 Oct 2022 18:45:18 -0700	[thread overview]
Message-ID: <166553911893.422356.7143540040827489080.stgit@magnolia> (raw)
In-Reply-To: <166553910766.422356.8069826206437666467.stgit@magnolia>

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

Add a new option, COREDUMP_COMPRESSOR, that will be used to compress
core dumps collected during a fstests run.  The program specified must
accept the -f -9 arguments that gzip has.

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


diff --git a/README b/README
index 80d148be82..4c4f22f853 100644
--- a/README
+++ b/README
@@ -212,6 +212,10 @@ Tools specification:
     - Set FSSTRESS_AVOID and/or FSX_AVOID, which contain options added to
       the end of fsstresss and fsx invocations, respectively, in case you wish
       to exclude certain operational modes from these tests.
+ - core dumps:
+    - Set COREDUMP_COMPRESSOR to a compression program to compress crash dumps.
+      This program must accept '-f' and the name of a file to compress.  In
+      other words, it must emulate gzip.
 
 Kernel/Modules related configuration:
  - Set TEST_FS_MODULE_RELOAD=1 to unload the module and reload it between
diff --git a/common/rc b/common/rc
index 152b8bb414..c68869b7dc 100644
--- a/common/rc
+++ b/common/rc
@@ -4956,13 +4956,17 @@ _save_coredump()
 	local core_hash="$(_md5_checksum "$path")"
 	local out_file="$RESULT_BASE/$seqnum.core.$core_hash"
 
-	if [ -s "$out_file" ]; then
-		rm -f "$path"
-		return
-	fi
-	rm -f "$out_file"
+	for dump in "$out_file"*; do
+		if [ -s "$dump" ]; then
+			rm -f "$path"
+			return 0
+		fi
+	done
 
 	mv "$path" "$out_file"
+	test -z "$COREDUMP_COMPRESSOR" && return 0
+
+	$COREDUMP_COMPRESSOR -f "$out_file"
 }
 
 init_rc


  parent reply	other threads:[~2022-10-12  1:45 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-12  1:45 [PATCHSET v2 0/2] fstests: improve coredump capture and storage Darrick J. Wong
2022-10-12  1:45 ` [PATCH 1/2] check: detect and preserve all coredumps made by a test Darrick J. Wong
2022-10-12 15:47   ` Zorro Lang
2022-10-12 15:51     ` Darrick J. Wong
2022-10-13  0:19   ` [PATCH v2.1 " Darrick J. Wong
2022-10-13 11:44     ` Zorro Lang
2022-10-13 15:48       ` Darrick J. Wong
2022-10-13 16:03         ` Zorro Lang
2022-10-13 16:27           ` Darrick J. Wong
2022-10-14 18:15             ` Darrick J. Wong
2022-10-14 18:20   ` [PATCH v2.2 " Darrick J. Wong
2022-10-12  1:45 ` Darrick J. Wong [this message]
2022-10-13 11:51   ` [PATCH 2/2] check: optionally compress core dumps Zorro Lang
2022-10-13 15:50     ` Darrick J. Wong
  -- strict thread matches above, loose matches on Subject: below --
2022-10-05 22:31 [PATCHSET 0/2] fstests: improve coredump capture and storage Darrick J. Wong
2022-10-05 22:31 ` [PATCH 2/2] check: optionally compress core dumps Darrick J. Wong
2022-10-07 12:45   ` Zorro Lang
2022-10-07 21:32     ` 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=166553911893.422356.7143540040827489080.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 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.