Whamcloud - gitweb
b=13798
[fs/lustre-release.git] / lustre / tests / sanity-quota.sh
index ab43295..9e84a37 100644 (file)
@@ -17,7 +17,7 @@ SRCDIR=`dirname $0`
 export PATH=$PWD/$SRCDIR:$SRCDIR:$PWD/$SRCDIR/../utils:$PATH:/sbin
 
 ONLY=${ONLY:-"$*"}
-ALWAYS_EXCEPT=${ALWAYS_EXCEPT:-""}
+ALWAYS_EXCEPT="$SANITY_QUOTA_EXCEPT"
 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
 
 case `uname -r` in
@@ -577,7 +577,7 @@ run_test 6 "Block quota acquire & release ========="
 # quota recovery (block quota only by now)
 test_7()
 {
-       remote_mds && skip "remote mds"
+       remote_mds && skip "remote mds" && return 0
 
        LIMIT=$(( $BUNIT_SZ * $(($OSTCOUNT + 1)) * 10)) # 10 bunits each sever
        TESTFILE="$TSTDIR/quota_tst70"
@@ -668,8 +668,8 @@ test_9() {
         set_blk_tunesz $((1024 * 50))
 
         # set the D_QUOTA flag
-       DBG_SAVE="`sysctl -n lnet.debug`"
-       sysctl -w lnet.debug="$DBG_SAVE quota"
+       debugsave
+       sysctl -w lnet.debug="+quota"
 
         TESTFILE="$TSTDIR/quota_tst90"
 
@@ -711,7 +711,7 @@ test_9() {
         set_blk_tunesz $BTUNE_SZ
         set_blk_unitsz $BUNIT_SZ
 
-       sysctl -w lnet.debug="$DBG_SAVE"
+       debugrestore
         return $RC
 }
 run_test 9 "run for fixing bug10707(64bit) ==========="
@@ -737,12 +737,9 @@ test_10() {
        set_blk_tunesz $((1024 * 50))
 
        # set the D_QUOTA flag
-       set_flag=0
-       if [ -z "`sysctl lnet.debug | grep quota`" ]; then
-               sysctl -w lnet.debug="+quota"
-               set_flag=1
-       fi
-
+       debugsave
+       sysctl -w lnet.debug="+quota"
+       
        # make qd_count 32 bit
        sysctl -w lustre.fail_loc=0xA00
 
@@ -785,9 +782,7 @@ test_10() {
        RC=$?
 
        # clear the flage
-       if [ $set_flag -eq 1 ]; then
-               sysctl -w lnet.debug="-quota"
-       fi
+       debugrestore
 
        # make qd_count 64 bit
        sysctl -w lustre.fail_loc=0
@@ -991,16 +986,20 @@ check_if_quota_zero(){
        echo "pass check_if_quota_zero"
 }
 
-# test setting quota on root, b=12223
-test_13(){
-        TESTFILE="$TSTDIR/quota_tst13"
+pre_test_14 () {
+        # reboot the lustre
+        cd $T_PWD; sh llmountcleanup.sh || error "llmountcleanup failed"
+        sh llmount.sh
+        pre_test
+        setup
+        run_test 0 "reboot lustre"
+}
 
-       # reboot the lustre
-       cd $T_PWD; sh llmountcleanup.sh || error "llmountcleanup failed"
-       sh llmount.sh 
-       pre_test
-       setup
-       run_test 0 "reboot lustre"
+pre_test_14 
+
+test_14(){ # b=12223 -- setting quota on root
+       mkdir $TSTDIR/$tdir || error "mkdir $TSTDIR/$tdir failed"
+       TESTFILE="$TSTDIR/$tdir/$tfile"
 
        # out of root's file and block quota
         $LFS setquota -u root 10 10 10 10 $MOUNT
@@ -1018,7 +1017,7 @@ test_13(){
        for i in `seq 1 10`; do $RUNAS rm -f ${TESTFILE}a_$i; done 
 
        # do the check
-       dmesg | tail | grep "\-122" |grep llog_obd_origin_add && error "test_13 failed."
+       dmesg | tail | grep "\-122" |grep llog_obd_origin_add && error "err -122 not found in dmesg" 
        $LFS setquota -u root 0 0 0 0 $MOUNT
        #check_if_quota_zero u root
 
@@ -1026,7 +1025,7 @@ test_13(){
        unlinkmany ${TESTFILE} 15
        rm -f $TESTFILE
 }
-run_test 13 "test setting quota on root ==="
+run_test 14 "test setting quota on root ==="
 
 # turn off quota
 test_99()