xfstests: rename USE_BIG_LOOPFS to be more generic
[xfstests-dev.git] / 103
1 #! /bin/bash
2 # FS QA Test No. 103
3 #
4 # Exercise the XFS nosymlinks inode flag
5 #
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2000-2005 Silicon Graphics, Inc.  All Rights Reserved.
8 #
9 # This program is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU General Public License as
11 # published by the Free Software Foundation.
12 #
13 # This program is distributed in the hope that it would be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write the Free Software Foundation,
20 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
21 #
22 #-----------------------------------------------------------------------
23 #
24 # creator
25 owner=nathans@sgi.com
26
27 seq=`basename $0`
28 echo "QA output created by $seq"
29
30 here=`pwd`
31 tmp=/tmp/$$
32 status=1        # failure is the default!
33 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
34
35 # get standard environment, filters and checks
36 . ./common.rc
37 . ./common.filter
38
39 _create_scratch()
40 {
41         echo "*** mkfs"
42         if ! _scratch_mkfs_xfs >$tmp.out 2>&1
43         then
44                 cat $tmp.out
45                 echo "failed to mkfs $SCRATCH_DEV"
46                 exit 1
47         fi
48
49         echo "*** mount"
50         if ! _scratch_mount 2>/dev/null
51         then
52                 echo "failed to mount $SCRATCH_DEV"
53                 exit 1
54         fi
55 }
56
57 _filter_noymlinks_flag()
58 {
59         _test_inode_flag nosymlinks $SCRATCH_MNT/nosymlink
60         if [ $? -eq 0 ]; then
61                 echo "--n-- SCRATCH_MNT/nosymlink"
62         else
63                 echo "----- SCRATCH_MNT/nosymlink"
64         fi
65 }
66
67 # real QA test starts here
68 _supported_os Linux IRIX
69 _supported_fs xfs
70 _require_command $XFS_IO_PROG xfs_io
71 _require_scratch
72
73 _create_scratch
74
75
76 echo "*** testing nosymlinks directories"
77 mkdir $SCRATCH_MNT/nosymlink
78 echo "*** setting nosymlinks bit"
79 $XFS_IO_PROG -r -c 'chattr +n' $SCRATCH_MNT/nosymlink
80 _filter_noymlinks_flag
81
82 touch $SCRATCH_MNT/nosymlink/source
83 ln -s $SCRATCH_MNT/nosymlink/source $SCRATCH_MNT/nosymlink/target 2>&1 \
84         | _filter_scratch | _filter_ln
85 ln $SCRATCH_MNT/nosymlink/source $SCRATCH_MNT/nosymlink/hardlinksareok
86
87 echo "*** 1st listing..."
88 find $SCRATCH_MNT | _filter_scratch
89
90 echo "*** clearing nosymlinks bit"
91 $XFS_IO_PROG -r -c 'chattr -n' $SCRATCH_MNT/nosymlink
92 _filter_noymlinks_flag
93
94 ln -s $SCRATCH_MNT/nosymlink/source $SCRATCH_MNT/nosymlink/target
95 ln $SCRATCH_MNT/nosymlink/source $SCRATCH_MNT/nosymlink/hardlinksareok2
96
97 echo "*** 2nd listing..."
98 find $SCRATCH_MNT | _filter_scratch
99
100 echo "*** finished testing nosymlinks directories"
101
102 status=0
103 exit