--- ltp-full-20090831.orig/testcases/kernel/fs/acls/acl_test01 2009-08-31 07:15:46.000000000 +0200 +++ ltp-full-20090831/testcases/kernel/fs/acls/acl_test01 2009-09-09 09:02:48.000000000 +0200 @@ -24,17 +24,91 @@ # # HISTORY: # 03/03 Jerone Young (jyoung5@us.ibm.com) +# 09/08 Jacky Malcles changing the setup to have this TC started by runltp #********************************************************************* -export PATH=$PATH:/usr/sbin/ +# +################################################################ +# +# Make sure that uid=root is running this script. +# Make sure that loop device is built into the kernel +# Make sure that ACL(Access Control List) and Extended Attribute are +# built into the kernel +# +# +################################################################ TEST_USER1="acltest1" TEST_USER1_GROUP="users" TEST_USER1_PASSWD="ltp_test_pass1" -#ensure the test partition is ACL aware -TEST_USER1_HOMEDIR="/tmp/$TEST_USER1" +TEST_USER1_HOMEDIR="tacl/mount-ext3/$TEST_USER1" + +FILE_ACL="tacl/mount-ext3/test_file" +FILE_ACL_LINK="tacl/mount-ext3/test_file_link" +TCbin=`pwd` + +iam=`whoami` +if [ "z$iam" = "z$TEST_USER1" ] +then + echo "" +else +if [ $UID != 0 ] +then + echo "FAILED: Must have root access to execute this script" + exit 1 +fi + +if [ ! -e tacl ] +then + mkdir -m 777 tacl +else + echo "FAILED: Directory tacl are exist" + exit 1 +fi + +# The following commands can be used as an example of using the loop +# device. + +dd if=/dev/zero of=tacl/blkext3 bs=1k count=10240 +chmod 777 tacl/blkext3 +# +losetup /dev/loop0 tacl/blkext3 2>&1 > /dev/null +if [ $? != 0 ] +then + echo "" + echo "FAILED: [ losetup ] Must have loop device support by kernel" + echo -e "\t to execute this script" + exit 1 +fi + +mount | grep ext2 +if [ $? != 0 ] +then + mkfs -t ext3 /dev/loop0 #> /dev/null 2>&1 + mkdir -m 777 tacl/mount-ext3 + mount -t ext3 -o defaults,acl,user_xattr /dev/loop0 tacl/mount-ext3 + if [ $? != 0 ] + then + echo "" + echo "FAILED: [ mount ] Make sure that ACL (Access Control List)" + echo -e "\t and Extended Attribute are built into the kernel" + echo -e "\t Can not mount ext3 file system with acl and user_xattr options" + exit 1 + fi +else + mkfs -t ext2 /dev/loop0 + mkdir -m 777 tacl/mount-ext3 + mount -t ext2 -o defaults,acl,user_xattr /dev/loop0 tacl/mount-ext3 + if [ $? != 0 ] + then + echo "" + echo "FAILED: [ mount ] Make sure that ACL (Access Control List)" + echo -e "\t and Extended Attribute are built into the kernel" + echo -e "\t Can not mount ext2 file system with acl and user_xattr options" + exit 1 + fi +fi +fi -FILE_ACL="/tmp/test_file" -FILE_ACL_LINK="/tmp/test_file_link" #----------------------------------------------------------------------- # FUNCTION: do_setup @@ -55,7 +129,7 @@ do_setup(){ rm -rf $TEST_USER1_HOMEDIR userdel $TEST_USER1 > /dev/null 2>&1 sleep 1 - useradd -d $TEST_USER1_HOMEDIR -m -g $TEST_USER1_GROUP $TEST_USER1 -s /bin/sh + useradd -d `pwd`/$TEST_USER1_HOMEDIR -m -g $TEST_USER1_GROUP $TEST_USER1 -s /bin/sh if [ $? != 0 ] then { @@ -81,6 +155,9 @@ do_cleanup() { userdel $TEST_USER1 rm -f $FILE_ACL > /dev/null 2>&1 rm -f $FILE_ACL_LINK > /dev/null 2>&1 + umount -d tacl/mount-ext3 + rm -rf tacl + } #----------------------------------------------------------------------- @@ -91,6 +168,7 @@ iam=`whoami` EXIT_CODE=0 if [ "z$iam" = "z$TEST_USER1" ] then + echo "" echo "TESTING ACLS FOR 2ND USER $iam" #setup files for extended attributes @@ -118,6 +196,7 @@ then fi else do_setup + echo "" echo "TESTING ACLS FOR USER $iam" touch $FILE_ACL @@ -150,11 +229,8 @@ else chown $TEST_USER1 $FILE_ACL chown $TEST_USER1 $FILE_ACL_LINK - if [ -z ${TCbin} ] - then - export TCbin=$PWD - fi - + su $TEST_USER1 -c "$0" + echo "" do_cleanup fi