X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Ftests%2Fsanity-quota.sh;h=9e84a37290e67af68da228307829bdd26f103d3f;hb=270c267e2fad4c1aa730ab9a88fed284340349d2;hp=0e1e3f1c7789195ce58ed56b6aa7e153e3f2ff05;hpb=14d1efa1ecda80f11f6cc1d42c517dcfdf914ce5;p=fs%2Flustre-release.git diff --git a/lustre/tests/sanity-quota.sh b/lustre/tests/sanity-quota.sh index 0e1e3f1..9e84a37 100644 --- a/lustre/tests/sanity-quota.sh +++ b/lustre/tests/sanity-quota.sh @@ -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 @@ -48,85 +48,14 @@ ITUNE_SZ=${ITUNE_SZ:-5} # default 50% of IUNIT_SZ MAX_DQ_TIME=604800 MAX_IQ_TIME=604800 -QUOTALOG=${TESTSUITELOG:-$TMP/$(basename $0 .sh).log} -FAIL_ON_ERROR=false - -log() { - echo "$*" - $LCTL mark "$*" 2> /dev/null || true -} - -trace() { - log "STARTING: $*" - strace -o $TMP/$1.strace -ttt $* - RC=$? - log "FINISHED: $*: rc $RC" - return 1 -} TRACE=${TRACE:-""} +LUSTRE=${LUSTRE:-`dirname $0`/..} +. $LUSTRE/tests/test-framework.sh +init_test_env $@ +. ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh} -run_one() { - BEFORE=`date +%s` - log "== test $1: $2= `date +%H:%M:%S` ($BEFORE)" - export TESTNAME=test_$1 - test_$1 || error "exit with rc=$?" - unset TESTNAME - pass "($((`date +%s` - $BEFORE))s)" - cd $SAVE_PWD -} - -build_test_filter() { - [ "$ALWAYS_EXCEPT$EXCEPT$SANITY_EXCEPT" ] && \ - echo "Skipping tests: `echo $ALWAYS_EXCEPT $EXCEPT $SANITY_QUOTA_EXCEPT`" - - for O in $ONLY; do - eval ONLY_${O}=true - done - for E in $EXCEPT $ALWAYS_EXCEPT $SANITY_QUOTA_EXCEPT; do - eval EXCEPT_${E}=true - done - # turn on/off quota tests must be included - eval ONLY_0=true - eval ONLY_99=true -} - -_basetest() { - echo $* -} - -basetest() { - IFS=abcdefghijklmnopqrstuvwxyz _basetest $1 -} - -run_test() { - base=`basetest $1` - if [ "$ONLY" ]; then - testname=ONLY_$1 - if [ ${!testname}x != x ]; then - run_one $1 "$2" - return $? - fi - testname=ONLY_$base - if [ ${!testname}x != x ]; then - run_one $1 "$2" - return $? - fi - echo -n "." - return 0 - fi - testname=EXCEPT_$1 - if [ ${!testname}x != x ]; then - TESTNAME=test_$1 skip "skipping excluded test $1" - return 0 - fi - testname=EXCEPT_$base - if [ ${!testname}x != x ]; then - TESTNAME=test_$1 skip "skipping excluded test $1 (base $base)" - return 0 - fi - run_one $1 "$2" - return $? -} +QUOTALOG=${TESTSUITELOG:-$TMP/$(basename $0 .sh).log} +FAIL_ON_ERROR=false [ "$QUOTALOG" ] && rm -f $QUOTALOG || true @@ -162,7 +91,6 @@ DIR=${DIR:-$MOUNT} [ -z "`echo $DIR | grep $MOUNT`" ] && echo "$DIR not in $MOUNT" && exit 99 DIR2=${DIR2:-$MOUNT_2} -LPROC=/proc/fs/lustre LOVNAME=`cat $LPROC/llite/*/lov/common_name | tail -n 1` OSTCOUNT=`cat $LPROC/lov/$LOVNAME/numobd` STRIPECOUNT=`cat $LPROC/lov/$LOVNAME/stripecount` @@ -178,6 +106,8 @@ SHOW_QUOTA_INFO="$LFS quota -t $MOUNT" build_test_filter +eval ONLY_0=true +eval ONLY_99=true # set_blk_tunables(btune_sz) set_blk_tunesz() { @@ -647,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" @@ -738,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" @@ -781,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) ===========" @@ -807,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 @@ -855,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 @@ -1061,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 @@ -1088,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 @@ -1096,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()