Whamcloud - gitweb
remove unecessary debugging
[fs/lustre-release.git] / lustre / tests / replay-ost-single.sh
index 56e6faa..d0e534f 100755 (executable)
@@ -12,7 +12,8 @@ init_test_env $@
 ostfailover_HOST=${ostfailover_HOST:-$ost_HOST}
 
 # Skip these tests
-ALWAYS_EXCEPT=""
+ALWAYS_EXCEPT="5"
+# test 5 needs a larger fs than what local normally has
 
 gen_config() {
     rm -f $XMLCONFIG
@@ -33,7 +34,7 @@ cleanup() {
     if [ $activeost != "ost" ]; then
         fail ost
     fi
-    zconf_umount $MOUNT
+    zconf_umount `hostname` $MOUNT
     stop mds ${FORCE} $MDSLCONFARGS
     stop ost ${FORCE} --dump cleanup.log
 }
@@ -46,50 +47,48 @@ fi
 
 build_test_filter
 
-rm -f ostactive
+SETUP=${SETUP:-"setup"}
+CLEANUP=${CLEANUP:-"cleanup"}
 
-gen_config
+setup() {
+    gen_config
 
-start ost --reformat $OSTLCONFARGS
-PINGER=`cat /proc/fs/lustre/pinger`
-
-if [ "$PINGER" != "on" ]; then
-    echo "ERROR: Lustre must be built with --enable-pinger for this test."
-    stop ost
-    exit 1
-fi
-[ "$DAEMONFILE" ] && $LCTL debug_daemon start $DAEMONFILE $DAEMONSIZE
-start mds --reformat $MDSLCONFARGS
-zconf_mount $MOUNT
+    start ost --reformat $OSTLCONFARGS
+    [ "$DAEMONFILE" ] && $LCTL debug_daemon start $DAEMONFILE $DAEMONSIZE
+    start mds --reformat $MDSLCONFARGS
+    zconf_mount `hostname` $MOUNT
+}
 
 mkdir -p $DIR
 
+$SETUP
+
 test_0() {
-    replay_barrier ost
     fail ost
     cp /etc/profile  $DIR/$tfile
     sync
     diff /etc/profile $DIR/$tfile
+    rm -f $DIR/$tfile
 }
 run_test 0 "empty replay"
 
 test_1() {
-    replay_barrier ost
     date > $DIR/$tfile
     fail ost
     $CHECKSTAT -t file $DIR/$tfile || return 1
+    rm -f $DIR/$tfile
 }
 run_test 1 "touch"
 
 test_2() {
-    replay_barrier ost
     for i in `seq 10`; do
         echo "tag-$i" > $DIR/$tfile-$i
     done 
     fail ost
     for i in `seq 10`; do
-      grep -q "tag-$i" $DIR/$tfile-$i || error "f1c-$i"
+      grep -q "tag-$i" $DIR/$tfile-$i || error "f2-$i"
     done 
+    rm -f $DIR/$tfile-*
 }
 run_test 2 "|x| 10 open(O_CREAT)s"
 
@@ -120,5 +119,65 @@ test_4() {
 }
 run_test 4 "Fail OST during read, with verification"
 
+test_5() {
+    IOZONE_OPTS="-i 0 -i 1 -i 2 -+d -r 64 -s 1g"
+    iozone $IOZONE_OPTS -f $DIR/$tfile &
+    PID=$!
+    
+    sleep 10
+    fail ost
+    wait $PID || return 1
+    rm -f $DIR/$tfile
+}
+run_test 5 "Fail OST during iozone"
+
+kbytesfree() {
+   awk '{total+=$1} END {print total}' /proc/fs/lustre/osc/OSC_*MNT*/kbytesfree
+}
+
+test_6() {
+    f=$DIR/$tfile
+    sync
+    before=`kbytesfree`
+    dd if=/dev/urandom bs=1024 count=5120 of=$f
+#define OBD_FAIL_MDS_REINT_NET_REP       0x119
+    do_facet mds "sysctl -w lustre.fail_loc=0x80000119"
+    sync
+    after_dd=`kbytesfree`
+    echo "before: $before after_dd: $after_dd"
+    (( before > after_dd )) || return 1
+    rm -f $f
+    fail ost
+    $CHECKSTAT -t file $f && return 2 || true
+    sync
+    # let the delete happen
+    sleep 2
+    after=`kbytesfree`
+    echo "before: $before after: $after"
+    (( before == after ))  || return 3
+}
+run_test 6 "Fail OST before obd_destroy"
+
+test_7() {
+    f=$DIR/$tfile
+    before=`kbytesfree`
+    dd if=/dev/urandom bs=1024 count=5120 of=$f
+    sync
+    after_dd=`kbytesfree`
+    echo "before: $before after_dd: $after_dd"
+    (( before > after_dd )) || return 1
+    replay_barrier ost
+    rm -f $f
+    fail ost
+    $CHECKSTAT -t file $f && return 2 || true
+    sync
+    # let the delete happen
+    sleep 2
+    after=`kbytesfree`
+    echo "before: $before after: $after"
+    (( before == after )) || return 3
+}
+run_test 7 "Fail OST before obd_destroy"
+
 equals_msg test complete, cleaning up
-cleanup
+$CLEANUP