Make test 005 work on SuSE kernels, cleanup its use on other platforms too.
[xfstests-dev.git] / 005
diff --git a/005 b/005
index e98b4cd5bb1f4a593b8b2822e5e50b13077a344f..45068f8ccb7eca4ca77219f6a590d2b271175608 100755 (executable)
--- a/005
+++ b/005
@@ -1,48 +1,41 @@
 #! /bin/sh
-# XFS QA Test No. 005
-# $Id: 1.1 $
+# FS QA Test No. 005
 #
 # Test symlinks & ELOOP
 #
 #-----------------------------------------------------------------------
-# Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
-# 
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of version 2 of the GNU General Public License as
-# published by the Free Software Foundation.
-# 
-# This program is distributed in the hope that it would be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# 
-# Further, this software is distributed without any warranty that it is
-# free of the rightful claim of any third person regarding infringement
-# or the like.  Any license provided herein, whether implied or
-# otherwise, applies only to this software file.  Patent licenses, if
-# any, provided herein do not apply to combinations of this program with
-# other software, or any other product whatsoever.
-# 
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write the Free Software Foundation, Inc., 59
-# Temple Place - Suite 330, Boston MA 02111-1307, USA.
-# 
-# Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
-# Mountain View, CA  94043, or:
-# 
-# http://www.sgi.com 
-# 
-# For further information regarding this notice, see: 
-# 
-# http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+#  Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+#  USA
+#
+#  Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
+#  Mountain View, CA 94043, USA, or: http://www.sgi.com
 #-----------------------------------------------------------------------
 #
 # creator
 owner=dxm@sgi.com
 
 #
-# note ELOOP limit used to be 32 but changed to 8. Who know what
-# it might be next.
-#
+# Note1: On Linux, ELOOP limit used to be 32 but changed to 8, and lately
+# its become 5.  Who knows what it might be next.
+# Note2: On IRIX, the limit is around the 30 mark.
+# 
+# What we are looking for here is: no panic due to blowing the stack;
+# and that the ELOOP error code is returned at some point (the actual
+# limit point is unimportant, just checking that we do hit it).
+# 
 
 seq=`basename $0`
 echo "QA output created by $seq"
@@ -54,16 +47,20 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 
 _cleanup()
 {
-    cd $TEST_DIR
+    cd $testdir
     rm -f symlink_{0,1,2,3}{0,1,2,3,4,5,6,7,8,9} symlink_self empty_file
+    cd /
+    _cleanup_testdir
 }
 
 _touch()
 {
-    touch $@ 2>&1 | sed \
-       -e "s/creating \`//g" \
-       -e "s/setting times of \`//g" \
-       -e "s/'//g"
+    touch $@ 2>&1 | grep -q 'Too many levels of symbolic links'
+    if [ $? -eq 0 ]; then
+       echo "ELOOP returned.  Good."
+    else
+       echo "No ELOOP?  Unexpected!"
+    fi
 }
 
 # get standard environment, filters and checks
@@ -71,11 +68,21 @@ _touch()
 . ./common.filter
 
 # real QA test starts here
+_supported_fs xfs udf nfs
+
+# IRIX UDF does not support symlinks
+if [ $FSTYP == 'udf' ]; then
+    _supported_os Linux
+else
+    _supported_os Linux IRIX
+fi
+
+_setup_testdir
 
-cd $TEST_DIR
+cd $testdir
 
 o=empty_file
-_touch $o
+touch $o
 for f in symlink_{0,1,2,3}{0,1,2,3,4,5,6,7,8,9}
 do
     ln -s $o $f