Whamcloud - gitweb
b=20877 disable test_12 of sanity-quota.sh
[fs/lustre-release.git] / lustre / tests / sanity-quota.sh
index 6d9f8aa..45c830c 100644 (file)
@@ -19,7 +19,9 @@ export PATH=$PWD/$SRCDIR:$SRCDIR:$PWD/$SRCDIR/../utils:$PATH:/sbin
 ONLY=${ONLY:-"$*"}
 # test_11 has been used to protect a kernel bug(bz10912), now it isn't
 # useful any more. Then add it to ALWAYS_EXCEPT. b=19835
-ALWAYS_EXCEPT="10 $SANITY_QUOTA_EXCEPT"
+# We have changed the mechanism of quota, test_12 is meanless now.
+# b=20877
+ALWAYS_EXCEPT="10 12 $SANITY_QUOTA_EXCEPT"
 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
 
 case `uname -r` in
@@ -301,6 +303,36 @@ quota_init() {
 }
 quota_init
 
+test_quota_performance() {
+       TESTFILE="$DIR/$tdir/$tfile-0"
+       local size=$1
+       local stime=`date +%s`
+       $RUNAS dd if=/dev/zero of=$TESTFILE bs=1M count=$size || quota_error u $TSTUSR "write failure"
+       local etime=`date +%s`
+       delta=$((etime - stime))
+       if [ $delta -gt 0 ]; then
+           rate=$((size * 1024 / delta))
+           [ $rate -gt 1024 ] || error "SLOW IO for $TSTUSR (user): $rate KB/sec"
+       fi
+       rm -f $TESTFILE
+}
+
+# test basic quota performance b=21696
+test_0() {
+       mkdir -p $DIR/$tdir
+       chmod 0777 $DIR/$tdir
+       MB=100
+       [ "$SLOW" = "no" ] && MB=10
+
+       test_quota_performance $MB
+
+       $LFS setquota -u $TSTUSR -b 0 -B $((1024*1024)) -i 0 -I 0 $DIR
+       test_quota_performance $MB
+
+       resetquota -u $TSTUSR
+}
+run_test_with_stat 0 "Test basic quota performance ==="
+
 # test for specific quota limitation, qunit, qtune $1=block_quota_limit
 test_1_sub() {
         LIMIT=$1
@@ -320,14 +352,7 @@ test_1_sub() {
         chown $TSTUSR.$TSTUSR $TESTFILE
 
         log "    Write ..."
-        stime=`date +%s`
        $RUNAS dd if=/dev/zero of=$TESTFILE bs=$BLK_SZ count=$(($LIMIT/2)) || quota_error u $TSTUSR "(usr) write failure, but expect success"
-        etime=`date +%s`
-        delta=$((etime - stime))
-        if [ $delta -gt 0 ]; then
-                rate=$((BLK_SZ * LIMIT / 2 / delta / 1024))
-                [ $rate -gt 1024 ] || error "SLOW IO for $TSTUSR (user): $rate KB/sec"
-        fi
         log "    Done"
         log "    Write out of block quota ..."
        # this time maybe cache write,  ignore it's failure
@@ -358,14 +383,7 @@ test_1_sub() {
         chown $TSTUSR.$TSTUSR $TESTFILE
 
         log "    Write ..."
-        stime=`date +%s`
        $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))
-        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