X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Ftests%2FsanityN.sh;h=974fdbb155b31e47b426c011299105fcd06e4f41;hb=2dc9c16e770415d56839e1996015fec5fab93f29;hp=1895c8a8169666e0b43fd0b3354b6d4c88fd625e;hpb=a2a0746305449dbd925879b14dc2c0d6040bb8bf;p=fs%2Flustre-release.git diff --git a/lustre/tests/sanityN.sh b/lustre/tests/sanityN.sh index 1895c8a..974fdbb 100644 --- a/lustre/tests/sanityN.sh +++ b/lustre/tests/sanityN.sh @@ -3,7 +3,11 @@ set -e ONLY=${ONLY:-"$*"} -ALWAYS_EXCEPT=${ALWAYS_EXCEPT:-"8"} # bug 1557 +# bug number for skipped test: 1768 +ALWAYS_EXCEPT=${ALWAYS_EXCEPT:-"4 14b"} +# UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT! + +[ "$ALWAYS_EXCEPT$EXCEPT" ] && echo "Skipping tests: $ALWAYS_EXCEPT $EXCEPT" SRCDIR=`dirname $0` PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH @@ -46,7 +50,7 @@ START=${START:-start} log() { echo "$*" - lctl mark "$*" || true + lctl mark "$*" 2> /dev/null || true } run_one() { @@ -54,7 +58,9 @@ run_one() { $START fi log "== test $1: $2" - test_$1 || error + export TESTNAME=test_$1 + test_$1 || error "test_$1: exit with rc=$?" + unset TESTNAME pass cd $SAVE_PWD $CLEAN @@ -82,28 +88,34 @@ run_test() { fi } +[ "$SANITYLOG" ] && rm -f $SANITYLOG || true + error () { - echo "FAIL: $@" - exit 1 + log "FAIL: $TESTNAME $@" + if [ "$SANITYLOG" ]; then + echo "FAIL: $TESTNAME $@" >> $SANITYLOG + else + exit 1 + fi } pass() { echo PASS } -MOUNT1=`mount| awk '/^'$NAME' .* lustre_lite / { print $3 }'| head -1` -MOUNT2=`mount| awk '/^'$NAME' .* lustre_lite / { print $3 }'| tail -1` +export MOUNT1=`mount| awk '/ lustre/ { print $3 }'| head -n 1` +export MOUNT2=`mount| awk '/ lustre/ { print $3 }'| tail -n 1` [ -z "$MOUNT1" ] && error "NAME=$NAME not mounted once" [ "$MOUNT1" = "$MOUNT2" ] && error "NAME=$NAME not mounted twice" -[ `mount| awk '/^'$NAME' .* lustre_lite / { print $3 }'| wc -l` -ne 2 ] && \ +[ `mount| awk '/ lustre/ { print $3 }'| wc -l` -ne 2 ] && \ error "NAME=$NAME mounted more than twice" -DIR1=${DIR1:-$MOUNT1} -DIR2=${DIR2:-$MOUNT2} +export DIR1=${DIR1:-$MOUNT1} +export DIR2=${DIR2:-$MOUNT2} [ -z "`echo $DIR1 | grep $MOUNT1`" ] && echo "$DIR1 not in $MOUNT1" && exit 96 [ -z "`echo $DIR2 | grep $MOUNT2`" ] && echo "$DIR2 not in $MOUNT2" && exit 95 -rm -f $DIR1/[df][0-9]* $DIR1/lnk +rm -rf $DIR1/[df][0-9]* $DIR1/lnk test_1a() { touch $DIR1/f1 @@ -145,6 +157,19 @@ test_2b() { } run_test 2b "check cached attribute updates on 2 mtpt's ========" +# NEED TO SAVE ROOT DIR MODE +test_2c() { + chmod 777 $DIR1 + $CHECKSTAT -t dir -p 0777 $DIR2 || error +} +run_test 2c "check cached attribute updates on 2 mtpt's root ===" + +test_2d() { + chmod 755 $DIR1 + $CHECKSTAT -t dir -p 0755 $DIR2 || error +} +run_test 2d "check cached attribute updates on 2 mtpt's root ===" + test_3() { ( cd $DIR1 ; ln -s this/is/good lnk ) [ "this/is/good" = "`perl -e 'print readlink("'$DIR2/lnk'");'`" ] || \ @@ -153,13 +178,14 @@ test_3() { run_test 3 "symlink on one mtpt, readlink on another ===========" test_4() { - ./multifstat $DIR1/f6 $DIR2/f6 + ./multifstat $DIR1/f4 $DIR2/f4 } run_test 4 "fstat validation on multiple mount points ==========" test_5() { mcreate $DIR1/f5 truncate $DIR2/f5 100 + $CHECKSTAT -t file -s 100 $DIR1/f5 || error rm $DIR1/f5 } run_test 5 "create a file on one mount, truncate it on the other" @@ -187,11 +213,12 @@ test_9() { echo -n $C >> $DIR/f9 [ "$MTPT" -eq 1 ] && MTPT=2 || MTPT=1 done - [ "`cat $DIR1/f9`" = "abcdefghijkl" ] || error + [ "`cat $DIR1/f9`" = "abcdefghijkl" ] || \ + error "`od -a $DIR1/f9` != abcdefghijkl" } run_test 9 "append of file with sub-page size on multiple mounts" -test_10() { +test_10a() { MTPT=1 OFFSET=0 > $DIR2/f10 @@ -201,8 +228,108 @@ test_10() { [ "$MTPT" -eq 1 ] && MTPT=2 || MTPT=1 OFFSET=`expr $OFFSET + 1` done - [ "`cat $DIR1/f10`" = "abcdefghijkl" ] || error + [ "`cat $DIR1/f10`" = "abcdefghijkl" ] || \ + error "`od -a $DIR1/f10` != abcdefghijkl" +} +run_test 10a "write of file with sub-page size on multiple mounts " + +test_10b() { + yes "R" | dd of=$DIR1/f10b bs=3k count=1 || error "dd $DIR1" + + truncate $DIR1/f10b 4096 || error "truncate 4096" + + dd if=$DIR2/f10b of=$TMP/f10b-lustre bs=4k count=1 || error "dd $DIR2" + + # create a test file locally to compare + yes "R" | dd of=$TMP/f10b bs=3k count=1 || error "dd random" + truncate $TMP/f10b 4096 || error "truncate 4096" + cmp $TMP/f10b $TMP/f10b-lustre || error "file miscompare" } -run_test 10 "write of file with sub-page size on multiple mounts " +run_test 10b "write of file with sub-page size on multiple mounts " + +test_11() { + mkdir $DIR1/d11 + multiop $DIR1/d11/f O_c & + MULTIPID=$! + usleep 200 + cp -p /bin/ls $DIR1/d11/f + $DIR2/d11/f + RC=$? + kill -USR1 $MULTIPID + wait $MULTIPID || error + [ $RC -eq 0 ] && error || true +} +run_test 11 "execution of file opened for write should return error ====" + +test_12() { + sh lockorder.sh +} +run_test 12 "test lock ordering (link, stat, unlink) ===========" + +test_13() { # bug 2451 - directory coherency + rm -rf $DIR1/d13 + mkdir $DIR1/d13 || error + cd $DIR1/d13 || error + ls + ( touch $DIR1/d13/f13 ) # needs to be a separate shell + ls + rm -f $DIR2/d13/f13 || error + ls 2>&1 | grep f13 && error "f13 shouldn't return an error (1)" || true + # need to run it twice + ( touch $DIR1/d13/f13 ) # needs to be a separate shell + ls + rm -f $DIR2/d13/f13 || error + ls 2>&1 | grep f13 && error "f13 shouldn't return an error (2)" || true +} +run_test 13 "test directory page revocation ====================" + +test_14() { + mkdir $DIR1/d14 + cp -p /bin/ls $DIR1/d14/ls + exec 100>> $DIR1/d14/ls + $DIR2/d14/ls && error || true + exec 100<&- +} +run_test 14 "execution of file opened for write should return -ETXTBSY==" + +test_14a() { + mkdir -p $DIR1/d14 + cp -p `which multiop` $DIR1/d14/multiop + $DIR1/d14/multiop $TMP/test14.junk O_c & + MULTIPID=$! + sleep 1 + multiop $DIR2/d14/multiop Oc && error "expected error, got success" + kill -USR1 $MULTIPID || return 2 + wait $MULTIPID || return 3 +} +run_test 14a "open(RDWR) of file being executed should return -ETXTBSY" + +test_14b() { + mkdir -p $DIR1/d14 + cp -p `which multiop` $DIR1/d14/multiop + $DIR1/d14/multiop $TMP/test14.junk O_c & + MULTIPID=$! + sleep 1 + truncate $DIR2/d14/multiop 0 && error "expected error, got success" + kill -USR1 $MULTIPID || return 2 + wait $MULTIPID || return 3 +} +run_test 14b "truncate of file being executed should return -ETXTBSY" + +test_15() { # bug 974 - ENOSPC + echo $PATH + sh oos2.sh $MOUNT1 $MOUNT2 +} +run_test 15 "test out-of-space with multiple writers ===========" + +test_16() { + ./fsx -R -W -c 50 -p 100 -N 2500 \ + $MOUNT1/fsxfile $MOUNT2/fsxfile +} +run_test 16 "2500 iterations of dual-mount fsx =================" + +log "cleanup: ======================================================" +rm -rf $DIR1/[df][0-9]* $DIR1/lnk || true -rm -f $DIR1/f[0-9]* $DIR1/lnk +echo '=========================== finished ===============================' +[ -f "$SANITYLOG" ] && cat $SANITYLOG && exit 1 || true