Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / lustre / tests / sanity.sh
index e9e1e60..63506ad 100644 (file)
@@ -7,8 +7,8 @@
 set -e
 
 ONLY=${ONLY:-"$*"}
-# bug number for skipped test: 2108 9789 3637 9789 3561 12622 12653 12653 13310 10764
-ALWAYS_EXCEPT="                42a  42b  42c  42d  45   51d   65a   65e   74b   75   $SANITY_EXCEPT"
+# bug number for skipped test: 2108 9789 3637 9789 3561 12622 12653 12653 10764
+ALWAYS_EXCEPT="                42a  42b  42c  42d  45   51d   65a   65e   75   $SANITY_EXCEPT"
 # bug number for skipped test: 2108 9789 3637 9789 3561 5188/5749 1443
 #ALWAYS_EXCEPT=${ALWAYS_EXCEPT:-"27m 42a 42b 42c 42d 45 68 76"}
 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
@@ -27,8 +27,8 @@ case `uname -r` in
 *) error "unsupported kernel" ;;
 esac
 
-SRCDIR=`dirname $0`
-export PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH:/sbin
+SRCDIR=$(cd $(dirname $0); echo $PWD)
+export PATH=$PATH:/sbin
 
 TMP=${TMP:-/tmp}
 
@@ -68,7 +68,7 @@ SAVE_PWD=$PWD
 CLEANUP=${CLEANUP:-:}
 SETUP=${SETUP:-:}
 TRACE=${TRACE:-""}
-LUSTRE=${LUSTRE:-`dirname $0`/..}
+LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
 . $LUSTRE/tests/test-framework.sh
 init_test_env $@
 . ${CONFIG:=$LUSTRE/tests/cfg/${NAME}.sh}
@@ -110,7 +110,7 @@ fi
 check_and_setup_lustre
 
 DIR=${DIR:-$MOUNT}
-[ -z "`echo $DIR | grep $MOUNT`" ] && echo "$DIR not in $MOUNT" && exit 99
+assert_DIR
 
 LOVNAME=`lctl get_param -n llite.*.lov.common_name | tail -n 1`
 OSTCOUNT=`lctl get_param -n lov.$LOVNAME.numobd`
@@ -515,6 +515,7 @@ run_test 21 "write to dangling link ============================"
 
 test_22() {
        WDIR=$DIR/$tdir
+       mkdir -p $WDIR
        chown $RUNAS_ID $WDIR
        (cd $WDIR || error "cd $WDIR failed";
        $RUNAS tar cf - /etc/hosts /etc/sysconfig/network | \
@@ -781,6 +782,7 @@ run_test 26e "unlink multiple component recursive symlink ======"
 
 # recursive symlinks (bug 7022)
 test_26f() {
+       mkdir -p $DIR/$tdir
        mkdir $DIR/$tdir/$tfile        || error "mkdir $DIR/$tdir/$tfile failed"
        cd $DIR/$tdir/$tfile           || error "cd $DIR/$tdir/$tfile failed"
        mkdir -p lndir/bar1      || error "mkdir lndir/bar1 failed"
@@ -1875,6 +1877,7 @@ test_42d() {
 run_test 42d "test complete truncate of file with cached dirty data"
 
 test_43() {
+       mkdir -p $DIR/$tdir
        cp -p /bin/ls $DIR/$tdir/$tfile
        multiop $DIR/$tdir/$tfile Ow_c &
        pid=$!
@@ -2706,7 +2709,9 @@ test_62() {
         cat $f && error "cat succeeded, expect -EIO"
         lctl set_param fail_loc=0
 }
-run_test 62 "verify obd_match failure doesn't LBUG (should -EIO)"
+# This test is now irrelevant (as of bug 10718 inclusion), we no longer
+# match every page all of the time.
+#run_test 62 "verify obd_match failure doesn't LBUG (should -EIO)"
 
 # bug 2319 - oig_wait() interrupted causes crash because of invalid waitq.
 test_63a() {   # was test_63
@@ -3262,7 +3267,7 @@ set_checksum_type()
        [ "$ORIG_CSUM_TYPE" ] || \
                ORIG_CSUM_TYPE=`lctl get_param -n osc/*osc-[^mM]*/checksum_type |
                                 sed 's/.*\[\(.*\)\].*/\1/g' | head -n1`
-       lctl set_param -n osc.*osc-*.checksum_type $1
+       lctl set_param -n osc.*osc-[^mM]*.checksum_type $1
        log "set checksum type to $1"
        return 0
 }
@@ -3475,6 +3480,20 @@ test_79() { # bug 12743
 }
 run_test 79 "df report consistency check ======================="
 
+test_80() { # bug 10718
+        dd if=/dev/zero of=$DIR/$tfile bs=1M count=1 seek=1M
+        sync; sleep 1; sync
+        BEFORE=`date +%s`
+        cancel_lru_locks OSC
+        AFTER=`date +%s`
+        DIFF=$((AFTER-BEFORE))
+        if [ $DIFF -gt 1 ] ; then
+                error "elapsed for 1M@1T = $DIFF"
+        fi
+        true
+}
+run_test 80 "Page eviction is equally fast at high offsets too  ===="
+
 # on the LLNL clusters, runas will still pick up root's $TMP settings,
 # which will not be writable for the runas user, and then you get a CVS
 # error message with a corrupt path string (CVS bug) and panic.
@@ -4021,6 +4040,7 @@ test_105c() {
 run_test 105c "lockf when mounted without -o flock test ========"
 
 test_106() { #bug 10921
+       mkdir -p $DIR/$tdir
        $DIR/$tdir && error "exec $DIR/$tdir succeeded"
        chmod 777 $DIR/$tdir || error "chmod $DIR/$tdir failed"
 }
@@ -4599,6 +4619,7 @@ test_119c() # bug 13099
 run_test 119c "Testing for direct read hitting hole"
 
 test_120a() {
+        mkdir -p $DIR/$tdir
         [ -z "`lctl get_param -n mdc.*.connect_flags | grep early_lock_cancel`" ] && \
                skip "no early lock cancel on server" && return 0
         lru_resize_disable mdc
@@ -4618,6 +4639,7 @@ test_120a() {
 run_test 120a "Early Lock Cancel: mkdir test"
 
 test_120b() {
+        mkdir -p $DIR/$tdir
         [ -z "`lctl get_param -n mdc.*.connect_flags | grep early_lock_cancel`" ] && \
                skip "no early lock cancel on server" && return 0
         lru_resize_disable mdc
@@ -4637,6 +4659,7 @@ test_120b() {
 run_test 120b "Early Lock Cancel: create test"
 
 test_120c() {
+        mkdir -p $DIR/$tdir
         [ -z "`lctl get_param -n mdc.*.connect_flags | grep early_lock_cancel`" ] && \
                skip "no early lock cancel on server" && return 0
         lru_resize_disable mdc
@@ -4658,6 +4681,7 @@ test_120c() {
 run_test 120c "Early Lock Cancel: link test"
 
 test_120d() {
+        mkdir -p $DIR/$tdir
         [ -z "`lctl get_param -n mdc.*.connect_flags | grep early_lock_cancel`" ] && \
                skip "no early lock cancel on server" && return 0
         lru_resize_disable mdc
@@ -4678,6 +4702,7 @@ test_120d() {
 run_test 120d "Early Lock Cancel: setattr test"
 
 test_120e() {
+        mkdir -p $DIR/$tdir
         [ -z "`lctl get_param -n mdc.*.connect_flags | grep early_lock_cancel`" ] && \
                skip "no early lock cancel on server" && return 0
         lru_resize_disable mdc
@@ -4706,6 +4731,7 @@ run_test 120e "Early Lock Cancel: unlink test"
 test_120f() {
         [ -z "`lctl get_param -n mdc.*.connect_flags | grep early_lock_cancel`" ] && \
                skip "no early lock cancel on server" && return 0
+        mkdir -p $DIR/$tdir
         lru_resize_disable mdc
         lru_resize_disable osc
         mkdir -p $DIR/$tdir/d1 $DIR/$tdir/d2
@@ -5074,42 +5100,41 @@ test_128() { # bug 15212
 run_test 128 "interactive lfs for 2 consecutive find's"
 
 test_129() {
-       [ "$FSTYPE" = "ldiskfs" ] || return 0
-       mkdir $DIR/$tdir
-
-       EFBIG=27
-       ldiskfs_prefix=/proc/fs/ldiskfs
-       proc_file=max_dir_size
-       max_bytes=16385
-
-       echo $max_bytes >$ldiskfs_prefix/$proc_file
-
-       I=0
-       J=0
-       while [ $I -lt $max_bytes ]; do
-               touch $DIR/$tdir/$J
-               J=$((J+1))
-               I=$(stat -c%s "$DIR/$tdir")
-       done
+        [ "$FSTYPE" != "ldiskfs" ] && skip "not needed for FSTYPE=$FSTYPE" && return 0
 
-       # One more file and we should be over the limit
-       multiop $DIR/$tdir/$J Oc
-       rc=$?
-       if [ $rc -eq 0 ]; then
-               rm -rf $DIR/$tdir
-               error "exceeded dir size limit: $I bytes"
-       elif [ $rc -ne $EFBIG ]; then
-               rm -rf $DIR/$tdir
-               error "return code $rc received instead of expected $EFBIG"
-       else
-               echo "return code $rc received as expected"
-       fi
+        DEV=$(basename $(do_facet mds lctl get_param -n osd.*MDT*.mntdev))
+        [ -z "$DEV" ] && error "can't access mds mntdev" 
+        EFBIG=27
+        LDPROC=/proc/fs/ldiskfs/$DEV/max_dir_size
+        MAX=16384
 
-       echo 0 >$ldiskfs_prefix/$proc_file
-       rm -rf $DIR/$tdir
+        do_facet mds "echo $MAX > $LDPROC"
+
+        mkdir -p $DIR/$tdir
+
+        I=0
+        J=0
+        while [ ! $I -gt $MAX ]; do
+                multiop $DIR/$tdir/$J Oc
+                rc=$?
+                if [ $rc -eq $EFBIG ]; then
+                        do_facet mds "echo 0 >$LDPROC"
+                        echo "return code $rc received as expected"
+                        return 0
+                elif [ $rc -ne 0 ]; then
+                        do_facet mds "echo 0 >$LDPROC"
+                        error_exit "return code $rc received instead of expected $EFBIG"
+                fi
+                J=$((J+1))
+                I=$(stat -c%s "$DIR/$tdir")
+        done
+
+        error "exceeded dir size limit: $I bytes"
+        do_facet mds "echo 0 >$LDPROC"
 }
 run_test 129 "test directory size limit ========================"
 
+
 TMPDIR=$OLDTMPDIR
 TMP=$OLDTMP
 HOME=$OLDHOME