On Fri, Oct 07, 2022 at 08:45:26PM +0800, Zorro Lang wrote: > On Wed, Oct 05, 2022 at 03:31:21PM -0700, Darrick J. Wong wrote: > > From: Darrick J. Wong <djwong@xxxxxxxxxx> > > > > Compress coredumps whenever desired to save space. > > > > Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx> > > --- > > 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. > > This patch looks good to me, just one question I'm thinking -- should this > parameter be under "Misc:" or "Tools specification:" part? If the former is > good, then: I was thinking misc, buuut it occurs to me that perhaps we ought to let people specify a different compression program, e.g. COMPRESS_COREDUMPS=xz ./check generic/444 in which case this would be a tool spec thing. I think I'll go back and rework this to do that. --D > Reviewed-by: Zorro Lang <zlang@xxxxxxxxxx> > > > > > > ______________________ > > 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" > > } > > > > >