Fix up some autoconf macros to get freebsd builds working again.
[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     touch $@ 2>&1 | grep -q 'Too many levels of symbolic links'
59     if [ $? -eq 0 ]; then
60         echo "ELOOP returned.  Good."
61     else
62         echo "No ELOOP?  Unexpected!"
63     fi
64 }
65
66 # get standard environment, filters and checks
67 . ./common.rc
68 . ./common.filter
69
70 # real QA test starts here
71 _supported_fs xfs udf nfs
72
73 # IRIX UDF does not support symlinks
74 if [ $FSTYP == 'udf' ]; then
75     _supported_os Linux
76 else
77     _supported_os Linux IRIX
78 fi
79
80 _setup_testdir
81
82 cd $testdir
83
84 o=empty_file
85 touch $o
86 for f in symlink_{0,1,2,3}{0,1,2,3,4,5,6,7,8,9}
87 do
88     ln -s $o $f
89     o=$f
90 done
91
92 ln -s symlink_self symlink_self
93
94 echo "*** touch deep symlinks"
95 echo ""
96 _touch symlink_{0,1,2,3}{0,1,2,3,4,5,6,7,8,9}
97 echo ""
98 echo "*** touch recusive symlinks"
99 echo ""
100 _touch symlink_self
101
102 exit