xfs/004: don't fail test due to realtime files
[xfstests-dev.git] / tests / xfs / 199
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2008 Christoph Hellwig.
4 #
5 # FS QA Test No. 199
6 #
7 # Check that the features2 location fixups work correctly.  We check both
8 # a regular read-write mount of a filesystem and the case where the
9 # filesystem is first mounted read-only and then later remounted read-write,
10 # which is the usual case for the root filesystem.
11 #
12 seq=`basename $0`
13 seqres=$RESULT_DIR/$seq
14 echo "QA output created by $seq"
15
16 here=`pwd`
17 tmp=/tmp/$$
18 status=1        # failure is the default!
19
20 _cleanup()
21 {
22         cd /
23         _scratch_unmount >/dev/null 2>&1
24 }
25 trap "_cleanup; exit \$status" 0 1 2 3 15
26
27 # get standard environment, filters and checks
28 . ./common/rc
29 . ./common/filter
30
31 # real QA test starts here
32 _supported_fs xfs
33
34 _require_scratch
35
36 # clear any mkfs options so that we can directly specify the options we need to
37 # be able to test the features bitmask behaviour correctly.
38 MKFS_OPTIONS=
39 _scratch_mkfs_xfs -m crc=0 -l lazy-count=1 >/dev/null 2>&1
40
41 # Grab the initial configuration. This checks mkfs sets the fields properly, and
42 # gives us the values the resultant tests should be the same as for testing at
43 # the end of the test. We don't hard code feature values, because that makes the
44 # test break every time we change mkfs feature defaults.
45 f2=`_scratch_xfs_get_sb_field features2`
46 bf2=`_scratch_xfs_get_sb_field bad_features2`
47
48 #
49 # Now clear the normal flags
50 #
51 echo "Clearing features2:"
52 _scratch_xfs_db -x  -c 'sb' -c 'write features2 0'
53
54 _scratch_mount
55 _scratch_unmount
56 rwf2=`_scratch_xfs_get_sb_field features2`
57
58 #
59 # Clear the normal flags again for the second rount.
60 #
61 echo "Clearing features2:"
62 _scratch_xfs_db -x  -c 'sb' -c 'write features2 0'
63
64 #
65 # And print the flags after a mount ro and remount rw
66 #
67 _scratch_mount -o ro
68 _scratch_mount -o remount,rw
69 _scratch_unmount
70 rof2=`_scratch_xfs_get_sb_field features2`
71
72 [ "$f2" != "$bf2" ] && echo "mkfs: features2 $f2 != bad_features2 $bf2"
73 [ "$f2" != "$rwf2" ] && echo "mount rw: old features2 $f2 != new features2 $rwf2"
74 [ "$f2" != "$rof2" ] && echo "ro->rw: old features2 $f2 != new features2 $rof2"
75
76 # success, all done
77 echo "*** done"
78 rm -f $seqres.full
79 status=0