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