Whamcloud - gitweb
Land b_smallfix onto HEAD (20040223_1817)
[fs/lustre-release.git] / lustre / tests / sanity.sh
index 5337a42..ea4810e 100644 (file)
@@ -14,7 +14,7 @@ ALWAYS_EXCEPT=${ALWAYS_EXCEPT:-""}
 [ "$ALWAYS_EXCEPT$EXCEPT" ] && echo "Skipping tests: $ALWAYS_EXCEPT $EXCEPT"
 
 SRCDIR=`dirname $0`
-PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH
+export PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH
 
 TMP=${TMP:-/tmp}
 
@@ -1081,7 +1081,7 @@ test_33a() {
         $RUNAS $OPENFILE -f O_RDWR:O_CREAT -m 0444 $DIR/d33/f33 || error
         $RUNAS $OPENFILE -f O_RDWR:O_CREAT -m 0444 $DIR/d33/f33 && error || true
 }
-run_test 33a "test open file(mode=0444) with O_RDWR (should return error) ===="
+run_test 33a "test open file(mode=0444) with O_RDWR (should return error)"
 
 TEST_34_SIZE=${TEST_34_SIZE:-2000000000000}
 test_34a() {
@@ -1277,7 +1277,7 @@ run_test 42b "test destroy of file with cached dirty data ======"
 # any number of fixes (don't get {0,EOF} on open, match
 # composite locks, do smarter file size management) fix
 # this, but for now we want these tests to verify that
-# the cancelation with truncate intent works, so we
+# the cancellation with truncate intent works, so we
 # start the file with a full-file pw lock to match against
 # until the truncate.
 trunc_test() {
@@ -1305,7 +1305,7 @@ test_42c() {
             error "$BEFOREWRITES < $AFTERWRITES on truncate"
         rm $file
 }
-run_test 42c "test partial truncate of file with cached dirty data ===="
+run_test 42c "test partial truncate of file with cached dirty data"
 
 test_42d() {
         trunc_test 42d 0
@@ -1313,51 +1313,49 @@ test_42d() {
             error "beforewrites $BEFOREWRITES != afterwrites $AFTERWRITES on truncate"
         rm $file
 }
-run_test 42d "test complete truncate of file with cached dirty data ===="
+run_test 42d "test complete truncate of file with cached dirty data"
 
 test_43() {
        mkdir $DIR/d43
        cp -p /bin/ls $DIR/d43/f
-       exec 100>> $DIR/d43/f   
+       exec 100>> $DIR/d43/f
        $DIR/d43/f && error || true
        exec 100<&-
 }
-run_test 43 "execution of file opened for write should return -ETXTBSY=="
+run_test 43 "execution of file opened for write should return -ETXTBSY"
 
 test_43a() {
         mkdir -p $DIR/d43
        cp -p `which multiop` $DIR/d43/multiop
-        touch $DIR/d43/g
-        $DIR/d43/multiop $DIR/d43/g o_c &
+        $DIR/d43/multiop $TMP/test43.junk O_c &
         MULTIPID=$!
         sleep 1
         multiop $DIR/d43/multiop Oc && error "expected error, got success"
         kill -USR1 $MULTIPID || return 2
         wait $MULTIPID || return 3
 }
-run_test 43a "open(RDWR) of file being executed should return -ETXTBSY=="
+run_test 43a "open(RDWR) of file being executed should return -ETXTBSY"
 
 test_43b() {
         mkdir -p $DIR/d43
        cp -p `which multiop` $DIR/d43/multiop
-        touch $DIR/d43/g
-        $DIR/d43/multiop $DIR/d43/g o_c &
+        $DIR/d43/multiop $TMP/test43.junk O_c &
         MULTIPID=$!
         sleep 1
         truncate $DIR/d43/multiop 0 && error "expected error, got success"
         kill -USR1 $MULTIPID || return 2
         wait $MULTIPID || return 3
 }
-run_test 43b "truncate of file being executed should return -ETXTBSY===="
+run_test 43b "truncate of file being executed should return -ETXTBSY"
 
 test_43c() {
        local testdir="$DIR/d43c"
        mkdir -p $testdir
        cp $SHELL $testdir/
-       ( cd $(dirname $SHELL) && md5sum $(basename $SHELL) ) |  \
+       ( cd $(dirname $SHELL) && md5sum $(basename $SHELL) ) | \
                ( cd $testdir && md5sum -c)
 }
-run_test 43c "md5sum of copy into lustre================================"
+run_test 43c "md5sum of copy into lustre========================"
 
 test_44() {
        [  "$STRIPECOUNT" -lt "2" ] && echo "skipping 2-stripe test" && return
@@ -1414,6 +1412,8 @@ do_dirty_record() {
 }
 test_45() {
        f="$DIR/f45"
+       # Obtain grants from OST if it supports it
+       echo blah > ${f}_grant
        stop_kupdated
        sync
        do_dirty_record "echo blah > $f"
@@ -1427,7 +1427,7 @@ test_45() {
        do_dirty_record "echo blah > $f"
        [ $before -eq $after ] && error "write wasn't cached"
        do_dirty_record "cancel_lru_locks OSC"
-       [ $before -gt $after ] || error "lock cancelation didn't lower dirty count"
+       [ $before -gt $after ] || error "lock cancellation didn't lower dirty count"
        start_kupdated
 }
 run_test 45 "osc io page accounting ============================"
@@ -1466,7 +1466,7 @@ test_48() {
         mkdir $DIR/d48 || error "recreate diectory failed"
         ls || error "can't list after recreate directory"
 }
-run_test 48 "Access renamed current working directory ========="
+run_test 48 "Access renamed current working directory =========="
 
 test_50() {
        # bug 1485
@@ -1615,7 +1615,62 @@ test_56() {
                 error "lfs find --obd wrong: should not show file on other obd"
         echo "lfs find --obd passed."
 }
-run_test 56 "check lfs find====================================="
+run_test 56 "check lfs find ===================================="
+
+test_57a() {
+       # note test will not do anything if MDS is not local
+       for DEV in `cat /proc/fs/lustre/mds/*/mntdev`; do
+               dumpe2fs -h $DEV > $TMP/t57a.dump || error "can't access $DEV"
+               DEVISIZE=`awk '/Inode size:/ { print $3 }' $TMP/t57a.dump`
+               [ "$DEVISIZE" -gt 128 ] || error "inode size $DEVISIZE"
+               rm $TMP/t57a.dump
+       done
+}
+run_test 57a "verify MDS filesystem created with large inodes =="
+
+test_57b() {
+       FILECOUNT=100
+       FILE1=$DIR/d57b/f1
+       FILEN=$DIR/d57b/f$FILECOUNT
+       rm -rf $DIR/d57b || error "removing $DIR/d57b"
+       mkdir -p $DIR/d57b || error "creating $DIR/d57b"
+       echo "mcreating $FILECOUNT files"
+       createmany -m $DIR/d57b/f 1 $FILECOUNT || \
+               error "creating files in $DIR/d57b"
+
+       # verify that files do not have EAs yet
+       $LFIND $FILE1 2>&1 | grep -q "no stripe" || error "$FILE1 has an EA"
+       $LFIND $FILEN 2>&1 | grep -q "no stripe" || error "$FILEN has an EA"
+
+       MDSFREE="`cat /proc/fs/lustre/mds/*/kbytesfree`"
+       MDCFREE="`cat /proc/fs/lustre/mdc/*/kbytesfree`"
+       echo "opening files to create objects/EAs"
+       for FILE in `seq -f $DIR/d57b/f%g 1 $FILECOUNT`; do
+               $OPENFILE -f O_RDWR $FILE > /dev/null || error "opening $FILE"
+       done
+
+       # verify that files have EAs now
+       $LFIND $FILE1 | grep -q "obdidx" || error "$FILE1 missing EA"
+       $LFIND $FILEN | grep -q "obdidx" || error "$FILEN missing EA"
+
+       MDSFREE2="`cat /proc/fs/lustre/mds/*/kbytesfree`"
+       MDCFREE2="`cat /proc/fs/lustre/mdc/*/kbytesfree`"
+       if [ "$MDCFREE" != "$MDCFREE2" ]; then
+               if [ "$MDSFREE" != "$MDSFREE2" ]; then
+                       error "MDC before $MDCFREE != after $MDCFREE2"
+               else
+                       echo "MDC before $MDCFREE != after $MDCFREE2"
+                       echo "unable to confirm if MDS has large inodes"
+               fi
+       fi
+       rm -rf $DIR/d57b
+}
+run_test 57b "default LOV EAs are stored inside large inodes ==="
+
+test_58() {
+       wiretest
+}
+run_test 58 "verify cross-platform wire constants =============="
 
 test_59() {
        echo "touch 130 files"
@@ -1654,12 +1709,11 @@ test_62() {
         cancel_lru_locks OSC
         echo 0x405 > /proc/sys/lustre/fail_loc
         cat $f && error "cat succeeded, expect -EIO"
-        multiop $f Owc && error "multiop succeeded, expect -EIO"
         echo 0 > /proc/sys/lustre/fail_loc
 }
 run_test 62 "verify obd_match failure doesn't LBUG (should -EIO)"
 
-# bug 2319 - osic_wait() interrupted causes crash because of invalid waitq.
+# bug 2319 - oig_wait() interrupted causes crash because of invalid waitq.
 test_63() {
        MAX_DIRTY_MB=`cat /proc/fs/lustre/osc/*/max_dirty_mb | head -1`
        for i in /proc/fs/lustre/osc/*/max_dirty_mb ; do
@@ -1677,7 +1731,18 @@ test_63() {
        done
        true
 }
-run_test 63 "Verify osic_wait interruption does not crash ======"
+run_test 63 "Verify oig_wait interruption does not crash ======"
+
+test_64a () {
+       df $DIR
+       grep "[0-9]" /proc/fs/lustre/osc/OSC*MNT*/cur*
+}
+run_test 64a "verify filter grant calculations (in kernel) ======"
+
+test_64b () {
+       sh oos.sh $MOUNT
+}
+run_test 64b "check out-of-space detection on client ============"
 
 # 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