For XFSQA test 018 081 082 095 the test specifies test wide mkfs options using MKFS_O...
[xfstests-dev.git] / 094
1 #! /bin/sh
2 # FS QA Test No. 094
3 #
4 # Exercising the inheritable realtime inode bit.
5 #
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2000-2005 Silicon Graphics, Inc.  All Rights Reserved.
8 #-----------------------------------------------------------------------
9 #
10 # creator
11 owner=nathans@sgi.com
12
13 seq=`basename $0`
14 echo "QA output created by $seq"
15
16 here=`pwd`
17 tmp=/tmp/$$
18 status=1        # failure is the default!
19 trap "_cleanup; exit \$status" 0 1 2 3 15
20
21 _cleanup()
22 {
23     cd /
24     rm -f $tmp.*
25 }
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 _supported_os IRIX Linux
34 _require_realtime
35 _require_scratch
36 _require_command /usr/sbin/xfs_io
37
38 _filter_realtime_flag()
39 {
40         _test_inode_flag realtime $SCRATCH_MNT/testdir/$1
41         if [ $? -eq 0 ]; then
42                 echo "--r-- SCRATCH_MNT/testdir/$1"
43         else
44                 echo "----- SCRATCH_MNT/testdir/$1"
45         fi
46 }
47
48 _filter_rtinherit_flag()
49 {
50         _test_inode_flag rt-inherit $SCRATCH_MNT/testdir
51         if [ $? -eq 0 ]; then
52                 echo "--t-- SCRATCH_MNT/testdir"
53         else
54                 echo "----- SCRATCH_MNT/testdir"
55         fi
56 }
57
58 _create_scratch()
59 {
60         echo "*** mkfs"
61         if ! _scratch_mkfs_xfs >$tmp.out 2>&1
62         then
63                 cat $tmp.out
64                 echo "failed to mkfs $SCRATCH_DEV"
65                 exit 1
66         fi
67
68         echo "*** mount"
69         if ! _scratch_mount
70         then
71                 echo "failed to mount $SCRATCH_DEV"
72                 exit 1
73         fi
74 }
75
76 _create_scratch
77 mkdir $SCRATCH_MNT/testdir
78
79 # set inode attribute, create files below and check they're marked realtime
80 # unset inode attribute, create files below and check they're not realtime
81
82 echo "*** create directory with rtinherit"
83 $XFS_IO_PROG -r -c 'chattr +t' $SCRATCH_MNT/testdir
84 _filter_rtinherit_flag
85
86 echo "*** create child with inherited realtime"
87 touch $SCRATCH_MNT/testdir/real
88 _filter_realtime_flag real
89
90 echo "*** remove rtinherit from directory"
91 $XFS_IO_PROG -r -c 'chattr -t' $SCRATCH_MNT/testdir
92 _filter_rtinherit_flag
93
94 echo "*** create child without inherited realtime"
95 touch $SCRATCH_MNT/testdir/unreal
96 _filter_realtime_flag unreal
97
98 echo "*** done"
99
100 # success, all done
101 status=0
102 exit