]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
check: optionally compress core dumps
authorDarrick J. Wong <djwong@kernel.org>
Sat, 15 Oct 2022 04:57:05 +0000 (12:57 +0800)
committerZorro Lang <zlang@kernel.org>
Sat, 15 Oct 2022 04:57:05 +0000 (12:57 +0800)
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.

README
common/rc

diff --git a/README b/README
index 80d148be82b4a8ed2b4868532bb139c639b6ca2f..4c4f22f853dee560ac07ce26b72746dda21b79dc 100644 (file)
--- 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
index 1a0f167f84a7bc33fe23fd58c5ee99106de91d5a..f4785c17ca576f72586813e4bb75e435b61cdff9 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -4962,13 +4962,17 @@ _save_coredump()
        local core_hash="$(_md5_checksum "$path")"
        local out_file="${seqres}.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