xfstests 250: remove unwanted new line in 250.out
[xfstests-dev.git] / 005
1 #! /bin/bash
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 #
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=dxm@sgi.com
26
27 #
28 # Note1: On Linux, ELOOP limit used to be 32 but changed to 8, and lately
29 # its become 5.  Who knows what it might be next.
30 # Note2: On IRIX, the limit is around the 30 mark.
31
32 # What we are looking for here is: no panic due to blowing the stack;
33 # and that the ELOOP error code is returned at some point (the actual
34 # limit point is unimportant, just checking that we do hit it).
35
36
37 seq=`basename $0`
38 echo "QA output created by $seq"
39
40 here=`pwd`
41 tmp=/tmp/$$
42 status=0        # success is the default!
43 trap "_cleanup; exit \$status" 0 1 2 3 15
44
45 _cleanup()
46 {
47     cd $testdir
48     rm -f symlink_{0,1,2,3,4}{0,1,2,3,4,5,6,7,8,9} symlink_self empty_file
49     cd /
50     _cleanup_testdir
51 }
52
53 _touch()
54 {
55     # On IRIX: Too many symbolic links in path name traversal
56     # On Linux: Too many levels of symbolic links
57     touch $@ 2>&1 | grep -q 'Too many.*symbolic links'
58     if [ $? -eq 0 ]; then
59         echo "ELOOP returned.  Good."
60     else
61         echo "No ELOOP?  Unexpected!"
62     fi
63 }
64
65 # get standard environment, filters and checks
66 . ./common.rc
67 . ./common.filter
68
69 # real QA test starts here
70 _supported_fs generic
71
72 # IRIX UDF does not support symlinks
73 if [ $FSTYP == 'udf' ]; then
74     _supported_os Linux
75 else
76     _supported_os Linux IRIX
77 fi
78
79 _setup_testdir
80
81 cd $testdir
82
83 o=empty_file
84 touch $o
85 for f in symlink_{0,1,2,3,4}{0,1,2,3,4,5,6,7,8,9}
86 do
87     ln -s $o $f
88     o=$f
89 done
90
91 ln -s symlink_self symlink_self
92
93 echo "*** touch deep symlinks"
94 echo ""
95 _touch symlink_{0,1,2,3,4}{0,1,2,3,4,5,6,7,8,9}
96 echo ""
97 echo "*** touch recusive symlinks"
98 echo ""
99 _touch symlink_self
100
101 exit