xfsqa: Add fiemap exerciser
[xfstests-dev.git] / 199
1 #! /bin/bash
2 # FS QA Test No. 199
3 #
4 # Check that the features2 location fixups work correctly.  We check both
5 # a regular read-write mount of a filesystem and the case where the
6 # filesystem is first mounted read-only and then later remounted read-write,
7 # which is the usual case for the root filesystem.
8 #
9 #-----------------------------------------------------------------------
10 # Copyright (c) 2008 Christoph Hellwig.
11 #
12 # This program is free software; you can redistribute it and/or
13 # modify it under the terms of the GNU General Public License as
14 # published by the Free Software Foundation.
15 #
16 # This program is distributed in the hope that it would be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 # GNU General Public License for more details.
20 #
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write the Free Software Foundation,
23 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
24 #-----------------------------------------------------------------------
25 #
26 # creator
27 owner=hch@lst.de
28
29 seq=`basename $0`
30 echo "QA output created by $seq"
31
32 here=`pwd`
33 tmp=/tmp/$$
34 status=1        # failure is the default!
35
36 _cleanup()
37 {
38         cd /
39         umount $SCRATCH_MNT >/dev/null 2>&1
40 }
41 trap "_cleanup; exit \$status" 0 1 2 3 15
42
43 # get standard environment, filters and checks
44 . ./common.rc
45 . ./common.filter
46
47 # real QA test starts here
48 _supported_fs xfs
49 _supported_os Linux
50
51 _require_scratch
52
53 _scratch_mkfs_xfs -l lazy-count=1 >/dev/null 2>&1
54
55 #
56 # Print the current flags.  Just a dummy so that the test breaks
57 # in an obvious way when the default feature flags changed in mkfs
58 #
59 echo "Default feature2 flags:"
60 xfs_db -x $SCRATCH_DEV -c 'sb' -c 'print features2'
61 xfs_db -x $SCRATCH_DEV -c 'sb' -c 'print bad_features2'
62
63 #
64 # Now clear the normal flags
65 #
66 echo "Clearing features2:"
67 xfs_db -x $SCRATCH_DEV -c 'sb' -c 'write features2 0'
68
69 _scratch_mount
70 umount $SCRATCH_MNT
71 echo "Features 2 after mount rw:"
72 xfs_db -x $SCRATCH_DEV -c 'sb' -c 'print features2'
73
74 #
75 # Clear the normal flags again for the second rount.
76 #
77 echo "Clearing features2:"
78 xfs_db -x $SCRATCH_DEV -c 'sb' -c 'write features2 0'
79
80 #
81 # And print the flags after a mount ro and remount rw
82 #
83 _scratch_mount -o ro
84 _scratch_mount -o remount,rw
85 umount $SCRATCH_MNT
86 echo "Features 2 after mount ro and remount rw:"
87 xfs_db -x $SCRATCH_DEV -c 'sb' -c 'print features2'
88
89 # success, all done
90 echo "*** done"
91 rm -f $seq.full
92 status=0