Whamcloud - gitweb
LU-2840 tests: Clean the environment for test.
[fs/lustre-release.git] / lustre / tests / sanityn.sh
index dcb3c0c..63b2aa7 100644 (file)
@@ -40,6 +40,10 @@ init_test_env $@
 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
 init_logging
 
+[ $(facet_fstype $SINGLEMDS) = "zfs" ] &&
+# bug number for skipped test:        LU-2840 LU-2776
+       ALWAYS_EXCEPT="$ALWAYS_EXCEPT 21      51a"
+
 [ "$SLOW" = "no" ] && EXCEPT_SLOW="12 23 33a"
 
 FAIL_ON_ERROR=false
@@ -468,18 +472,18 @@ run_test 20 "test extra readahead page left in cache ===="
 
 cleanup_21() {
        trap 0
-       umount $DIR1/d21
+       umount $DIR1/$tdir
 }
 
 test_21() { # Bug 5907
-       test_mkdir $DIR1/d21
-       mount /etc $DIR1/d21 --bind || error "mount failed" # Poor man's mount.
+       test_mkdir $DIR1/$tdir
+       mount /etc $DIR1/$tdir --bind || error "mount failed" # Poor man's mount.
        trap cleanup_21 EXIT
-       rmdir -v $DIR1/d21 && error "Removed mounted directory"
-       rmdir -v $DIR2/d21 && echo "Removed mounted directory from another mountpoint, needs to be fixed"
-       test -d $DIR1/d21 || error "Mounted directory disappeared"
+       rmdir -v $DIR1/$tdir && error "Removed mounted directory"
+       rmdir -v $DIR2/$tdir && echo "Removed mounted directory from another mountpoint, needs to be fixed"
+       test -d $DIR1/$tdir || error "Mounted directory disappeared"
        cleanup_21
-       test -d $DIR2/d21 || test -d $DIR1/d21 && error "Removed dir still visible after umount"
+       test -d $DIR2/$tdir || test -d $DIR1/$tdir && error "Removed dir still visible after umount"
        true
 }
 run_test 21 " Try to remove mountpoint on another dir ===="
@@ -2282,7 +2286,7 @@ test_51a() {
        # open and sleep 2 seconds then read
        $MULTIOP $DIR2/$tfile o_2r${filesize}c &
        local pid=$!
-       sleep 0.1
+       sleep 1
 
        # create the layout of testing file
        dd if=$origfile of=$DIR1/$tfile conv=notrunc > /dev/null
@@ -2307,7 +2311,7 @@ test_51b() {
        $LCTL set_param fail_loc=0x1404
        stat -c %s $DIR2/$tfile |tee $tmpfile &
        local pid=$!
-       sleep 0.1
+       sleep 1
 
        # create layout of testing file
        dd if=/dev/zero of=$DIR1/$tfile bs=1k count=1 conv=notrunc > /dev/null
@@ -2332,7 +2336,7 @@ test_51c() {
        echo "Setting layout ..."
        $LFS setstripe -c $OSTCOUNT $DIR1/$tfile &
        pid=$!
-       sleep 0.1
+       sleep 1
 
        # get layout of this file should wait until dd is finished
        local stripecnt=`$LFS getstripe -c $DIR2/$tfile`
@@ -2391,7 +2395,7 @@ test_60() {
 }
 run_test 60 "Verify data_version behaviour"
 
-test_70() {
+test_70a() {
        local test_dir=$tdir/test_dir
 
        mkdir -p $DIR1/$tdir
@@ -2407,7 +2411,26 @@ test_70() {
 
        cd $DIR2/$tdir || error "exit directory"
 }
-run_test 70 "cd directory && rm directory"
+run_test 70a "cd directory && rm directory"
+
+test_70b() { # LU-2781
+       local i
+       mkdir -p $DIR1/$tdir
+
+       touch $DIR1/$tdir/file
+       for ((i = 0; i < 32; i++)); do
+           $LFS rm_entry $DIR1/$tdir/non_existent_dir &>/dev/null
+       done
+       rm $DIR1/$tdir/file || error "cannot remove file after rm_entry"
+
+       touch $DIR1/$tdir/file
+       $LFS mkdir -i0 $DIR1/$tdir/test_dir
+       $LFS rm_entry $DIR1/$tdir/test_dir &>/dev/null
+       rm -rf $DIR1/$tdir/test_dir ||
+               error "cannot remove directory after rm_entry"
+       rm $DIR1/$tdir/file || error "cannot remove file after rm_entry"
+}
+run_test 70b "remove files after calling rm_entry"
 
 log "cleanup: ======================================================"