From: Subrata <ris...@li...> - 2010-06-02 12:48:34
|
The branch, master, has been updated via 7f20a3add6c7f2166dbab5a712713ae8b5943448 (commit) via 76ec975d298e3890a4ab2f9471940e164de0c643 (commit) from 91f337f9ee05b028af8506c7e83dc1b8c23a3b32 (commit) - Log ----------------------------------------------------------------- commit 7f20a3add6c7f2166dbab5a712713ae8b5943448 Author: Subrata Modak <sub...@su...> Date: Wed Jun 2 18:16:46 2010 +0530 Fix ext4_subdir_limit fix: We get the following error results since the if condition in ext4_subdir_limit_tset.sh does not work fine. The patch fixes this issue. [root@bsd086 ltp]# ./runltp -f fs_ext4 <snip> Ext4 subdir limit test ext4-subdir-limit 0 TINFO : Num of dirs to create: 65537, Dir name len: long name, mkdir: No space left on device ext4-subdir-limit 2 TFAIL : failed to create directories - 19118 <snip> ext4-subdir-limit 0 TINFO : Num of dirs to create: 65537, Dir name len: long name, mkdir: No space left on device ext4-subdir-limit 4 TFAIL : failed to create directories - 19592 Signed-off-by: Akira Fujita <a-f...@rs...>, commit 76ec975d298e3890a4ab2f9471940e164de0c643 Author: Subrata Modak <sub...@su...> Date: Wed Jun 2 18:15:19 2010 +0530 Fix for UTIMENSAT test fails hugely: This patch installs the trap for cleanup_test which removes the sudoers file only if it was installed by utimensat script, and also takes care of detecting whether sudo knows about the -n option. Signed-Off-By: <hy...@mv...>. ----------------------------------------------------------------------- Summary of changes: .../ext4-subdir-limit/ext4_subdir_limit_test.sh | 3 +- .../kernel/syscalls/utimensat/utimensat_tests.sh | 51 +++++++++++++++----- 2 files changed, 40 insertions(+), 14 deletions(-) diff --git a/testcases/kernel/fs/ext4-new-features/ext4-subdir-limit/ext4_subdir_limit_test.sh b/testcases/kernel/fs/ext4-new-features/ext4-subdir-limit/ext4_subdir_limit_test.sh index 5631fe5..f0a3b50 100755 --- a/testcases/kernel/fs/ext4-new-features/ext4-subdir-limit/ext4_subdir_limit_test.sh +++ b/testcases/kernel/fs/ext4-new-features/ext4-subdir-limit/ext4_subdir_limit_test.sh @@ -152,7 +152,8 @@ for ((i = 0; i < 3; i++)) { for ((k = 0; k < 2; k++)) { - if [ $i -eq $LONG_DIR -a $k -eq 1024 ]; then + if [ ${DIR_LEN[$k]} -eq $LONG_DIR -a \ + ${BLOCK_SIZE[$i]} -eq 1024 ]; then continue fi ext4_run_case 65537 ${DIR_LEN[$k]} ${PARENT_DIR[$j]} \ diff --git a/testcases/kernel/syscalls/utimensat/utimensat_tests.sh b/testcases/kernel/syscalls/utimensat/utimensat_tests.sh index 87514d8..4246d1a 100644 --- a/testcases/kernel/syscalls/utimensat/utimensat_tests.sh +++ b/testcases/kernel/syscalls/utimensat/utimensat_tests.sh @@ -64,13 +64,13 @@ setup_file() # Make sure any old version of file is deleted if test -e $FILE; then - sudo -n chattr -ai $FILE || return $? - sudo -n rm -f $FILE || return $? + sudo $s_arg chattr -ai $FILE || return $? + sudo $s_arg rm -f $FILE || return $? fi # Create file and make atime and mtime zero. - sudo -n -u $user_tester touch $FILE || return $? + sudo $s_arg -u $user_tester touch $FILE || return $? if ! $TEST_PROG -q $FILE 0 0 0 0 > $RESULT_FILE; then echo "Failed to set up test file $FILE" 1>&2 exit 1 @@ -86,19 +86,19 @@ setup_file() # Set owner, permissions, and EFAs for file. if test -n "$2"; then - sudo -n chown $2 $FILE || return $? + sudo $s_arg chown $2 $FILE || return $? fi - sudo -n chmod $3 $FILE || return $? + sudo $s_arg chmod $3 $FILE || return $? if test -n "$4"; then - sudo -n chattr $4 $FILE || return $? + sudo $s_arg chattr $4 $FILE || return $? fi # Display file setup, for visual verification ls -l $FILE | awk '{ printf "Owner=%s; perms=%s; ", $3, $1}' - if ! sudo -n lsattr -l $FILE | sed 's/, /,/g' | awk '{print "EFAs=" $2}' + if ! sudo $s_arg lsattr -l $FILE | sed 's/, /,/g' | awk '{print "EFAs=" $2}' then return $? fi @@ -215,7 +215,7 @@ run_test() cp $LTPROOT/testcases/bin/$TEST_PROG ./ CMD="./$TEST_PROG -q $FILE $4" echo "$CMD" - sudo -n -u $user_tester $CMD > $RESULT_FILE + sudo $s_arg -u $user_tester $CMD > $RESULT_FILE check_result $? $5 $6 $7 echo @@ -224,7 +224,7 @@ run_test() setup_file $FILE "$1" "$2" "$3" CMD="./$TEST_PROG -q -d $FILE NULL $4" echo "$CMD" - sudo -n -u $user_tester $CMD > $RESULT_FILE + sudo $s_arg -u $user_tester $CMD > $RESULT_FILE check_result $? $5 $6 $7 echo fi @@ -237,18 +237,43 @@ run_test() setup_file $FILE "$1" "$2" "$3" CMD="./$TEST_PROG -q -w -d $FILE NULL $4" echo "$CMD" - sudo -n -u $user_tester $CMD > $RESULT_FILE + sudo $s_arg -u $user_tester $CMD > $RESULT_FILE check_result $? $5 $6 $7 echo fi - sudo -n chattr -ai $FILE - sudo -n rm -f $FILE + sudo $s_arg chattr -ai $FILE + sudo $s_arg rm -f $FILE +} + +cleanup_test() +{ + if test $sudoers_clean; then + sudo rm -f $sudoers + fi } #===================================================================== user_tester=nobody -sudo -n -u $user_tester mkdir -p $TEST_DIR +echo "test sudo for -n option, non-interactive" +sudo -n true +if test $? -eq 0; then + s_arg="-n" + echo "sudo supports -n" +else + s_arg= + echo "sudo does not support -n" +fi +sudoers=/etc/sudoers +if test ! -e $sudoers +then + echo "root ALL=(ALL) ALL" > $sudoers + sudoers_clean=1 + chmod 440 $sudoers + trap 'trap "" EXIT; cleanup_test' EXIT +fi + +sudo $s_arg -u $user_tester mkdir -p $TEST_DIR cd $TEST_DIR chown root $LTPROOT/testcases/bin/$TEST_PROG chmod ugo+x,u+s $LTPROOT/testcases/bin/$TEST_PROG hooks/post-receive -- ltp |