fsx: Replace use of bzero() with memset()
[xfstests-dev.git] / 199
1 #! /bin/sh
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 #
13 # creator
14 owner=hch@lst.de
15
16 seq=`basename $0`
17 echo "QA output created by $seq"
18
19 here=`pwd`
20 tmp=/tmp/$$
21 status=1        # failure is the default!
22
23 _cleanup()
24 {
25         cd /
26         umount $SCRATCH_MNT >/dev/null 2>&1
27 }
28 trap "_cleanup; exit \$status" 0 1 2 3 15
29
30 # get standard environment, filters and checks
31 . ./common.rc
32 . ./common.filter
33
34 # real QA test starts here
35 _supported_fs xfs
36 _supported_os Linux
37
38 _require_scratch
39
40 _scratch_mkfs_xfs >/dev/null 2>&1
41
42 #
43 # Print the current flags.  Just a dummy so that the test breaks
44 # in an obvious way when the default feature flags changed in mkfs
45 #
46 echo "Default feature2 flags:"
47 xfs_db -x $SCRATCH_DEV -c 'sb' -c 'print features2'
48 xfs_db -x $SCRATCH_DEV -c 'sb' -c 'print bad_features2'
49
50 #
51 # Now clear the normal flags
52 #
53 echo "Clearing features2:"
54 xfs_db -x $SCRATCH_DEV -c 'sb' -c 'write features2 0'
55
56 _scratch_mount
57 umount $SCRATCH_MNT
58 echo "Features 2 after mount rw:"
59 xfs_db -x $SCRATCH_DEV -c 'sb' -c 'print features2'
60
61 #
62 # Clear the normal flags again for the second rount.
63 #
64 echo "Clearing features2:"
65 xfs_db -x $SCRATCH_DEV -c 'sb' -c 'write features2 0'
66
67 #
68 # And print the flags after a mount ro and remount rw
69 #
70 _scratch_mount -o ro
71 _scratch_mount -o remount,rw
72 umount $SCRATCH_MNT
73 echo "Features 2 after mount ro and remount rw:"
74 xfs_db -x $SCRATCH_DEV -c 'sb' -c 'print features2'
75
76 # success, all done
77 echo "*** done"
78 rm -f $seq.full
79 status=0