2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2017, Oracle and/or its affiliates. All Rights Reserved.
7 # Ensure that xfs_db fuzz command works as advertised.
10 seqres="$RESULT_DIR/$seq"
11 echo "QA output created by $seq"
15 status=1 # failure is the default!
16 trap "_cleanup; exit \$status" 0 1 2 3 15
24 # get standard environment, filters and checks
29 # real QA test starts here
32 _require_scratch_nocheck
33 _require_command "$XFS_DB_PROG" "xfs_db"
34 _require_xfs_db_command "fuzz"
39 _scratch_mkfs | _filter_mkfs 2>$tmp.mkfs >> "$seqres.full"
45 if [ $_fs_has_crcs -eq 0 ]; then
46 echo "Allowing $cmd of corrupted data with good CRC"
48 _scratch_xfs_db -x -c 'sb 0' -c "$*"
51 # Make sure that each fuzz verb works. For the firstbit/middlebit/lastbit
52 # tests, we depend on 'ones' having set the field to all ones.
54 do_xfs_db write -d ${field} 0
55 SCRATCH_XFS_LIST_FUZZ_VERBS= _scratch_xfs_list_fuzz_verbs | while read verb; do
56 test "${verb}" = "random" && continue
57 echo "Test verb ${verb}"
58 do_xfs_db fuzz -d ${field} ${verb}
61 echo "Test verb random"
62 before="$(_scratch_xfs_get_metadata_field "${field}" 'sb 0')"
63 do_xfs_db fuzz -d ${field} random >> $seqres.full
64 after="$(_scratch_xfs_get_metadata_field "${field}" 'sb 0')"
65 test "${before}" != "${after}" && echo "${field} changed"