xfs/530: skip test if user MKFS_OPTIONS screw up formatting
[xfstests-dev.git] / tests / xfs / 094
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2000-2005 Silicon Graphics, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 094
6 #
7 # Exercising the inheritable realtime inode bit.
8 #
9 . ./common/preamble
10 _begin_fstest metadata dir ioctl auto realtime
11
12 # Import common functions.
13 . ./common/filter
14
15 # real QA test starts here
16 _supported_fs xfs
17 _require_realtime
18 _require_scratch
19
20 _filter_realtime_flag()
21 {
22         _test_inode_flag realtime $SCRATCH_MNT/testdir/$1
23         if [ $? -eq 0 ]; then
24                 echo "--r-- SCRATCH_MNT/testdir/$1"
25         else
26                 echo "----- SCRATCH_MNT/testdir/$1"
27         fi
28 }
29
30 _filter_rtinherit_flag()
31 {
32         _test_inode_flag rt-inherit $SCRATCH_MNT/testdir
33         if [ $? -eq 0 ]; then
34                 echo "--t-- SCRATCH_MNT/testdir"
35         else
36                 echo "----- SCRATCH_MNT/testdir"
37         fi
38 }
39
40 _create_scratch()
41 {
42         echo "*** mkfs"
43         if ! _scratch_mkfs_xfs >$tmp.out 2>&1
44         then
45                 cat $tmp.out
46                 echo "failed to mkfs $SCRATCH_DEV"
47                 exit 1
48         fi
49
50         echo "*** mount"
51         if ! _try_scratch_mount
52         then
53                 echo "failed to mount $SCRATCH_DEV"
54                 exit 1
55         fi
56 }
57
58 _create_scratch
59 mkdir $SCRATCH_MNT/testdir
60
61 # set inode attribute, create files below and check they're marked realtime
62 # unset inode attribute, create files below and check they're not realtime
63
64 echo "*** create directory with rtinherit"
65 $XFS_IO_PROG -r -c 'chattr +t' $SCRATCH_MNT/testdir
66 _filter_rtinherit_flag
67
68 echo "*** create child with inherited realtime"
69 touch $SCRATCH_MNT/testdir/real
70 _filter_realtime_flag real
71
72 echo "*** remove rtinherit from directory"
73 $XFS_IO_PROG -r -c 'chattr -t' $SCRATCH_MNT/testdir
74 _filter_rtinherit_flag
75
76 echo "*** create child without inherited realtime"
77 touch $SCRATCH_MNT/testdir/unreal
78 _filter_realtime_flag unreal
79
80 echo "*** done"
81
82 # success, all done
83 status=0
84 exit