]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
fuzzy: dump metadata state before fuzzing
authorDarrick J. Wong <djwong@kernel.org>
Fri, 30 Dec 2022 22:19:41 +0000 (14:19 -0800)
committerZorro Lang <zlang@kernel.org>
Sat, 25 Feb 2023 13:13:37 +0000 (21:13 +0800)
When we start a fuzz test, dump the metadata to stdout so that anyone
analyzing a failure can see what was in the (supposedly) good image, and
what it turns into after fuzzing.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
common/fuzzy

index d2039d201fd52218424c6d40ad2fdba6834c81fb..3a60094285259ddae44352c3f6ef958a2b38e071 100644 (file)
@@ -110,6 +110,16 @@ __filter_xfs_db_print_fields() {
        done | grep -E "${filter}" | __filter_unvalidated_xfs_db_fields
 }
 
+# Dump the current contents of a metadata object.
+# All arguments are xfs_db commands to locate the metadata.
+_scratch_xfs_dump_metadata() {
+       local cmds=()
+       for arg in "$@"; do
+               cmds+=("-c" "${arg}")
+       done
+       _scratch_xfs_db "${cmds[@]}" -c print
+}
+
 # Navigate to some part of the filesystem and print the field info.
 # The first argument is an grep filter for the fields
 # The rest of the arguments are xfs_db commands to locate the metadata.
@@ -534,6 +544,8 @@ _scratch_xfs_fuzz_metadata() {
        echo $(echo "${fields}")
        echo "Verbs we propose to fuzz with:"
        echo $(echo "${verbs}")
+       echo "Current metadata object state:"
+       _scratch_xfs_dump_metadata "$@"
 
        # Always capture full core dumps from crashing tools
        ulimit -c unlimited