Add three additional quota tests - 106/107/108.
[xfstests-dev.git] / 005
1 #! /bin/sh
2 # FS QA Test No. 005
3 #
4 # Test symlinks & ELOOP
5 #
6 #-----------------------------------------------------------------------
7 #  Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
8 #  This program is free software; you can redistribute it and/or modify
9 #  it under the terms of the GNU General Public License as published by
10 #  the Free Software Foundation; either version 2 of the License, or
11 #  (at your option) any later version.
12 #
13 #  This program is distributed in the hope that it will 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 to the Free Software
20 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
21 #  USA
22 #
23 #  Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
24 #  Mountain View, CA 94043, USA, or: http://www.sgi.com
25 #-----------------------------------------------------------------------
26 #
27 # creator
28 owner=dxm@sgi.com
29
30 #
31 # Note1: On Linux, ELOOP limit used to be 32 but changed to 8, and lately
32 # its become 5.  Who knows what it might be next.
33 # Note2: On IRIX, the limit is around the 30 mark.
34
35 # What we are looking for here is: no panic due to blowing the stack;
36 # and that the ELOOP error code is returned at some point (the actual
37 # limit point is unimportant, just checking that we do hit it).
38
39
40 seq=`basename $0`
41 echo "QA output created by $seq"
42
43 here=`pwd`
44 tmp=/tmp/$$
45 status=0        # success is the default!
46 trap "_cleanup; exit \$status" 0 1 2 3 15
47
48 _cleanup()
49 {
50     cd $testdir
51     rm -f symlink_{0,1,2,3}{0,1,2,3,4,5,6,7,8,9} symlink_self empty_file
52     cd /
53     _cleanup_testdir
54 }
55
56 _touch()
57 {
58     # On IRIX: Too many symbolic links in path name traversal
59     # On Linux: Too many levels of symbolic links
60     touch $@ 2>&1 | tee -a $here/$seq.full | grep -q 'Too many.*symbolic links'
61     if [ $? -eq 0 ]; then
62         echo "ELOOP returned.  Good."
63     else
64         echo "No ELOOP?  Unexpected!"
65     fi
66 }
67
68 # get standard environment, filters and checks
69 . ./common.rc
70 . ./common.filter
71
72 # real QA test starts here
73 rm -f $here/$seq.full
74 _supported_fs xfs udf nfs
75
76 # IRIX UDF does not support symlinks
77 if [ $FSTYP == 'udf' ]; then
78     _supported_os Linux
79 else
80     _supported_os Linux IRIX
81 fi
82
83 _setup_testdir
84
85 cd $testdir
86
87 o=empty_file
88 touch $o
89 for f in symlink_{0,1,2,3}{0,1,2,3,4,5,6,7,8,9}
90 do
91     ln -s $o $f
92     o=$f
93 done
94
95 ln -s symlink_self symlink_self
96
97 echo "*** touch deep symlinks"
98 echo ""
99 _touch symlink_{0,1,2,3}{0,1,2,3,4,5,6,7,8,9}
100 echo ""
101 echo "*** touch recusive symlinks"
102 echo ""
103 _touch symlink_self
104
105 exit