xfs/530: skip test if user MKFS_OPTIONS screw up formatting
[xfstests-dev.git] / tests / xfs / 332
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
4 #
5 # FS QA Test No. 332
6 #
7 # Make sure query_range returns -EINVAL if lowkey > highkey.
8 #
9 . ./common/preamble
10 _begin_fstest auto quick rmap clone collapse punch insert zero
11
12 # Import common functions.
13 . ./common/filter
14 . ./common/attr
15
16 # real QA test starts here
17 _supported_fs xfs
18 _require_xfs_scratch_rmapbt
19 _require_command "$XFS_DB_PROG" "xfs_db"
20 _require_xfs_io_command "falloc"
21 _require_xfs_io_command "fpunch"
22 _require_xfs_io_command "fzero"
23 _require_xfs_io_command "fcollapse"
24 _require_xfs_io_command "finsert"
25
26 rm -f "$seqres.full"
27
28 echo "Format and mount"
29 _scratch_mkfs > "$seqres.full" 2>&1
30 _scratch_mount
31 blksz=65536
32 blocks=16
33 len=$((blocks * blksz))
34
35 echo "Create some files"
36 $XFS_IO_PROG -f -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full
37
38 echo "Manipulate file"
39 $XFS_IO_PROG -c "fpunch $blksz $blksz" \
40         -c "fzero $((3 * blksz)) $blksz" \
41         -c "pwrite -S 0x69 $((5 * blksz)) $blksz" \
42         -c "fpunch $((7 * blksz)) $blksz" \
43         -c "fsync" \
44         -c "pwrite -S 0x70 $((7 * blksz)) $blksz" \
45         -c "fcollapse $((9 * blksz)) $blksz" \
46         -c "finsert $((10 * blksz)) $blksz" $SCRATCH_MNT/f1 >> $seqres.full
47
48 echo "Check file"
49 md5sum $SCRATCH_MNT/f1 | _filter_scratch
50 od -tx1 -Ad -c $SCRATCH_MNT/f1 >> $seqres.full
51
52 echo "Unmount"
53 _scratch_unmount
54
55 echo "Try a regular fsmap"
56 _scratch_xfs_db -c 'fsmap' >> $seqres.full
57 _scratch_xfs_db -c 'fsmap 0 5' >> $seqres.full
58
59 echo "Try a bad fsmap"
60 _scratch_xfs_db -c 'fsmap 5 4'
61
62 # success, all done
63 status=0
64 exit