2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016, Oracle and/or its affiliates. All Rights Reserved.
7 # Make sure query_range returns -EINVAL if lowkey > highkey.
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
31 _require_xfs_scratch_rmapbt
32 _require_command "$XFS_DB_PROG" "xfs_db"
33 _require_xfs_io_command "falloc"
34 _require_xfs_io_command "fpunch"
35 _require_xfs_io_command "fzero"
36 _require_xfs_io_command "fcollapse"
37 _require_xfs_io_command "finsert"
41 echo "Format and mount"
42 _scratch_mkfs > "$seqres.full" 2>&1
46 len=$((blocks * blksz))
48 echo "Create some files"
49 $XFS_IO_PROG -f -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full
51 echo "Manipulate file"
52 $XFS_IO_PROG -c "fpunch $blksz $blksz" \
53 -c "fzero $((3 * blksz)) $blksz" \
54 -c "pwrite -S 0x69 $((5 * blksz)) $blksz" \
55 -c "fpunch $((7 * blksz)) $blksz" \
57 -c "pwrite -S 0x70 $((7 * blksz)) $blksz" \
58 -c "fcollapse $((9 * blksz)) $blksz" \
59 -c "finsert $((10 * blksz)) $blksz" $SCRATCH_MNT/f1 >> $seqres.full
62 md5sum $SCRATCH_MNT/f1 | _filter_scratch
63 od -tx1 -Ad -c $SCRATCH_MNT/f1 >> $seqres.full
68 echo "Try a regular fsmap"
69 _scratch_xfs_db -c 'fsmap' >> $seqres.full
70 _scratch_xfs_db -c 'fsmap 0 5' >> $seqres.full
72 echo "Try a bad fsmap"
73 _scratch_xfs_db -c 'fsmap 5 4'