Add a generic inode flag tester, fix filter in test 103.

Merge of master-melb:xfs-cmds:23132a by kenmcd.
This commit is contained in:
Nathan Scott
2005-07-11 14:57:36 +00:00
parent 9e4bae9c4b
commit 8b5b80690a
3 changed files with 164 additions and 157 deletions
+33 -35
View File
@@ -1,38 +1,37 @@
#! /bin/sh
# FS QA Test No. 103
#
# Exercise the XFS nosymlinks and project inheritance inode flags
# (for now only nosymlinks is tested; other is not yet implemented).
# Exercise the XFS nosymlinks inode flag
#
#-----------------------------------------------------------------------
# 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 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://www.sgi.com
#
# For further information regarding this notice, see:
#
# http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
#-----------------------------------------------------------------------
#
@@ -74,6 +73,16 @@ _filter_scratch()
sed -e "s,$SCRATCH_MNT,SCRATCH_MNT,g"
}
_filter_noymlinks_flag()
{
_test_inode_flag nosymlinks $SCRATCH_MNT/nosymlink
if [ $? -eq 0 ]; then
echo "--n-- SCRATCH_MNT/nosymlink"
else
echo "----- SCRATCH_MNT/nosymlink"
fi
}
# real QA test starts here
_supported_fs xfs
_require_command /usr/sbin/xfs_io
@@ -83,41 +92,30 @@ _create_scratch
echo "*** testing nosymlinks directories"
mkdir $SCRATCH_MNT/nosymlinks
mkdir $SCRATCH_MNT/nosymlink
echo "*** setting nosymlinks bit"
$XFS_IO_PROG -r -c 'chattr +n' -c lsattr $SCRATCH_MNT/nosymlinks \
$XFS_IO_PROG -r -c 'chattr +n' $SCRATCH_MNT/nosymlink
_filter_noymlinks_flag
touch $SCRATCH_MNT/nosymlink/source
ln -s $SCRATCH_MNT/nosymlink/source $SCRATCH_MNT/nosymlink/target 2>&1 \
| _filter_scratch
touch $SCRATCH_MNT/nosymlinks/source
ln -s $SCRATCH_MNT/nosymlinks/source $SCRATCH_MNT/nosymlinks/target 2>&1 \
| _filter_scratch
ln $SCRATCH_MNT/nosymlinks/source $SCRATCH_MNT/nosymlinks/hardlinksareok
ln $SCRATCH_MNT/nosymlink/source $SCRATCH_MNT/nosymlink/hardlinksareok
echo "*** 1st listing..."
find $SCRATCH_MNT | _filter_scratch
echo "*** clearing nosymlinks bit"
$XFS_IO_PROG -r -c 'chattr -n' -c lsattr $SCRATCH_MNT/nosymlinks | _filter_scratch
ln -s $SCRATCH_MNT/nosymlinks/source $SCRATCH_MNT/nosymlinks/target
ln $SCRATCH_MNT/nosymlinks/source $SCRATCH_MNT/nosymlinks/hardlinksareok2
$XFS_IO_PROG -r -c 'chattr -n' $SCRATCH_MNT/nosymlink
_filter_noymlinks_flag
ln -s $SCRATCH_MNT/nosymlink/source $SCRATCH_MNT/nosymlink/target
ln $SCRATCH_MNT/nosymlink/source $SCRATCH_MNT/nosymlink/hardlinksareok2
echo "*** 2nd listing..."
find $SCRATCH_MNT | _filter_scratch
echo "*** finished testing nosymlinks directories"
# echo "*** testing inherited project IDs"
# mkdir $SCRATCH_MNT/projectids
# $XFS_IO_PROG -r -c 'chattr +P' -c lsattr -c 'chproj 42' $SCRATCH_MNT/projectids\
# | _filter_scratch
# mkdir -p $SCRATCH_MNT/projectids/a/b
# touch $SCRATCH_MNT/projectids/a/b/c
# $XFS_IO_PROG -r -c 'lsattr -R' $SCRATCH_MNT/projectids
# $XFS_IO_PROG -r -c 'lsproj' $SCRATCH_MNT/projectids/a $SCRATCH_MNT/projectids/a/b/c\
# | _filter_scratch
# echo "*** 3rd listing..."
# find $SCRATCH_MNT | _filter_scratch
# echo "*** finished testing inherited project IDs"
status=0
exit
+11 -11
View File
@@ -3,20 +3,20 @@ QA output created by 103
*** mount
*** testing nosymlinks directories
*** setting nosymlinks bit
---------n SCRATCH_MNT/nosymlinks
ln: creating symbolic link `SCRATCH_MNT/nosymlinks/target' to `SCRATCH_MNT/nosymlinks/source': Operation not permitted
--n-- SCRATCH_MNT/nosymlink
ln: creating symbolic link `SCRATCH_MNT/nosymlink/target' to `SCRATCH_MNT/nosymlink/source': Operation not permitted
*** 1st listing...
SCRATCH_MNT
SCRATCH_MNT/nosymlinks
SCRATCH_MNT/nosymlinks/source
SCRATCH_MNT/nosymlinks/hardlinksareok
SCRATCH_MNT/nosymlink
SCRATCH_MNT/nosymlink/source
SCRATCH_MNT/nosymlink/hardlinksareok
*** clearing nosymlinks bit
---------- SCRATCH_MNT/nosymlinks
----- SCRATCH_MNT/nosymlink
*** 2nd listing...
SCRATCH_MNT
SCRATCH_MNT/nosymlinks
SCRATCH_MNT/nosymlinks/source
SCRATCH_MNT/nosymlinks/hardlinksareok
SCRATCH_MNT/nosymlinks/target
SCRATCH_MNT/nosymlinks/hardlinksareok2
SCRATCH_MNT/nosymlink
SCRATCH_MNT/nosymlink/source
SCRATCH_MNT/nosymlink/hardlinksareok
SCRATCH_MNT/nosymlink/target
SCRATCH_MNT/nosymlink/hardlinksareok2
*** finished testing nosymlinks directories
+120 -111
View File
File diff suppressed because it is too large Load Diff