Whamcloud - gitweb
b=16890 Reorder tests 29 and 30
[fs/lustre-release.git] / lustre / tests / sanity-quota.sh
index d752e97..0492c79 100644 (file)
@@ -52,8 +52,6 @@ DIRECTIO=${DIRECTIO:-$LUSTRE/tests/directio}
 
 [ $MDSCOUNT -gt 1 ] && skip "CMD case" && exit 0
 
-unset ENABLE_QUOTA
-
 remote_mds_nodsh && skip "remote MDS with nodsh" && exit 0
 remote_ost_nodsh && skip "remote OST with nodsh" && exit 0
 
@@ -66,11 +64,15 @@ QUOTALOG=${TESTSUITELOG:-$TMP/$(basename $0 .sh).log}
 DIR=${DIR:-$MOUNT}
 DIR2=${DIR2:-$MOUNT2}
 
+QUOTA_AUTO_OLD=$QUOTA_AUTO
+export QUOTA_AUTO=0
+
 check_and_setup_lustre
 
 if [ x"$(som_check)" = x"enabled" ]; then
         echo "Som is enabled, Quota is temporary conflicts with it"
         check_and_cleanup_lustre
+        export QUOTA_AUTO=$QUOTA_AUTO_OLD
         exit 0
 fi
 
@@ -336,8 +338,10 @@ test_1_sub() {
        $RUNAS dd if=/dev/zero of=$TESTFILE bs=$BLK_SZ count=$(($LIMIT/2)) || quota_error g $TSTUSR "(grp) write failure, but expect success"
         etime=`date +%s`
         delta=$((etime - stime))
-        rate=$((BLK_SZ * LIMIT / 2 / delta / 1024))
-        [ $rate -gt 1024 ] || error "SLOW IO for $TSTUSR (group): $rate KB/sec"
+        if [ $delta -gt 0 ]; then
+               rate=$((BLK_SZ * LIMIT / 2 / delta / 1024))
+               [ $rate -gt 1024 ] || error "SLOW IO for $TSTUSR (group): $rate KB/sec"
+       fi
         log "    Done"
         log "    Write out of block quota ..."
        # this time maybe cache write, ignore it's failure
@@ -2058,30 +2062,6 @@ test_28() {
 }
 run_test_with_stat 28 "test for consistency for qunit when setquota (18574) ==========="
 
-test_30()
-{
-        local output
-        local LIMIT=1024
-        local TESTFILE="$DIR/$tdir/$tfile"
-        local GRACE=10
-
-        mkdir -p $DIR/$tdir
-        chmod 0777 $DIR/$tdir
-
-        $LFS setquota -t -u --block-grace $GRACE --inode-grace $MAX_IQ_TIME $DIR
-        $LFS setquota -u $TSTUSR -b $LIMIT -B 0 -i 0 -I 0 $DIR
-        $RUNAS dd if=/dev/zero of=$TESTFILE bs=1024 count=$((LIMIT * 2)) || true
-        cancel_lru_locks osc
-        sleep 5
-        $LFS setquota -u $TSTUSR -B 0 $DIR
-        output=`$SHOW_QUOTA_USER | grep $MOUNT | awk '{ print $5 }' | tr -d s`
-        [ "$output" -le "$((GRACE - 5))" ] || error "grace times were reset or unexpectedly high latency"
-        rm -f $TESTFILE
-        resetquota -u $TSTUSR
-        $LFS setquota -t -u --block-grace $MAX_DQ_TIME --inode-grace $MAX_IQ_TIME $DIR
-}
-run_test_with_stat 30 "hard limit updates should not reset grace times ================"
-
 test_29()
 {
         local BLK_LIMIT=$((100 * 1024 * 1024)) # 100G
@@ -2123,6 +2103,31 @@ test_29()
 }
 run_test_with_stat 29 "unhandled quotactls must not hang lustre client (19778) ========"
 
+test_30()
+{
+        local output
+        local LIMIT=1024
+        local TESTFILE="$DIR/$tdir/$tfile"
+        local GRACE=10
+
+        mkdir -p $DIR/$tdir
+        chmod 0777 $DIR/$tdir
+
+        $LFS setquota -t -u --block-grace $GRACE --inode-grace $MAX_IQ_TIME $DIR
+        $LFS setquota -u $TSTUSR -b $LIMIT -B 0 -i 0 -I 0 $DIR
+        $RUNAS dd if=/dev/zero of=$TESTFILE bs=1024 count=$((LIMIT * 2)) || true
+        cancel_lru_locks osc
+        sleep 5
+        $LFS setquota -u $TSTUSR -B 0 $DIR
+        $SHOW_QUOTA_USER
+        output=`$SHOW_QUOTA_USER | grep $MOUNT | awk '{ print $5 }' | tr -d s`
+        [ "$output" -le "$((GRACE - 5))" ] || error "grace times were reset or unexpectedly high latency"
+        rm -f $TESTFILE
+        resetquota -u $TSTUSR
+        $LFS setquota -t -u --block-grace $MAX_DQ_TIME --inode-grace $MAX_IQ_TIME $DIR
+}
+run_test_with_stat 30 "hard limit updates should not reset grace times ================"
+
 # turn off quota
 quota_fini()
 {
@@ -2135,5 +2140,6 @@ log "cleanup: ======================================================"
 cd $ORIG_PWD
 check_and_cleanup_lustre
 echo '=========================== finished ==============================='
+export QUOTA_AUTO=$QUOTA_AUTO_OLD
 [ -f "$QUOTALOG" ] && cat $QUOTALOG && grep -q FAIL $QUOTALOG && exit 1 || true
 echo "$0: completed"