Whamcloud - gitweb
b=13932
[fs/lustre-release.git] / lustre / tests / replay-single.sh
index 7455edc..b000b37 100755 (executable)
@@ -6,55 +6,33 @@ set -e
 #
 # This test needs to be run on the client
 #
-
+SAVE_PWD=$PWD
 LUSTRE=${LUSTRE:-`dirname $0`/..}
+SETUP=${SETUP:-}
+CLEANUP=${CLEANUP:-}
 . $LUSTRE/tests/test-framework.sh
 init_test_env $@
 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
+CHECK_GRANT=${CHECK_GRANT:-"yes"}
+GRANT_CHECK_LIST=${GRANT_CHECK_LIST:-""}
 
 
 # Skip these tests
 # bug number: 2766 4176
 ALWAYS_EXCEPT="0b  39   $REPLAY_SINGLE_EXCEPT"
 
-gen_config() {
-    rm -f $XMLCONFIG
-    add_mds $SINGLEMDS --dev $MDSDEV --size $MDSSIZE
-    if [ ! -z "$mdsfailover_HOST" ]; then
-        add_mdsfailover $SINGLEMDS --dev $MDSDEV --size $MDSSIZE
-    fi
-    
-    add_lov lov1 $SINGLEMDS --stripe_sz $STRIPE_BYTES \
-       --stripe_cnt $STRIPES_PER_OBJ --stripe_pattern 0
-    add_ost ost --lov lov1 --dev `ostdevname 1` --size $OSTSIZE
-    add_ost ost2 --lov lov1 --dev `ostdevname 2` --size $OSTSIZE
-    add_client client $SINGLEMDS --lov lov1 --path $MOUNT
-}
+#                                                       63 min  7 min  AT AT AT AT"
+[ "$SLOW" = "no" ] && EXCEPT="$EXCEPT 1 2 3 4 6 6b 12 16 44      44b    65 66 67 68"
 
 build_test_filter
 
-SETUP=${SETUP:-"setup"}
-CLEANUP=${CLEANUP:-"cleanupall"}
-
-if [ "$ONLY" == "cleanup" ]; then
-    sysctl -w lnet.debug=0 || true
-    $CLEANUP
-    exit 0
-fi
-
-setup() {
-    [ "$REFORMAT" ] && formatall
-    setupall
-}
-
-$SETUP
-
-if [ "$ONLY" == "setup" ]; then
-    exit 0
-fi
+cleanup_and_setup_lustre
 
 mkdir -p $DIR
 
+rm -rf $DIR/${TESTSUITE}/[df][0-9]* # bug 13798 new t-f tdir staff
+rm -rf $DIR/[df][0-9]*
+
 test_0() {
     sleep 10
     mkdir $DIR/$tfile
@@ -161,7 +139,7 @@ test_2a() {
 run_test 2a "touch"
 
 test_2b() {
-    ./mcreate $DIR/$tfile
+    mcreate $DIR/$tfile
     replay_barrier $SINGLEMDS
     touch $DIR/$tfile
     fail $SINGLEMDS
@@ -245,7 +223,6 @@ run_test 5 "|x| 220 open(O_CREAT)"
 
 test_6() {
     replay_barrier $SINGLEMDS
-    mkdir $DIR/$tdir
     mcreate $DIR/$tdir/$tfile
     fail $SINGLEMDS
     $CHECKSTAT -t dir $DIR/$tdir || return 1
@@ -264,7 +241,6 @@ test_6b() {
 run_test 6b "|X| rmdir"
 
 test_7() {
-    mkdir $DIR/$tdir
     replay_barrier $SINGLEMDS
     mcreate $DIR/$tdir/$tfile
     fail $SINGLEMDS
@@ -502,20 +478,24 @@ test_20b() { # bug 10480
 
     fail $SINGLEMDS                            # start orphan recovery
     df -P $DIR || df -P $DIR || true    # reconnect
-    sleep 2
+    wait_mds_recovery_done || error "MDS recovery not done"
 
+    # FIXME just because recovery is done doesn't mean we've finished 
+    # orphan cleanup.  Fake it with a sleep for now...
+    sleep 10
     AFTERUSED=`df -P $DIR | tail -1 | awk '{ print $3 }'`
     log "before $BEFOREUSED, after $AFTERUSED"
     [ $AFTERUSED -gt $((BEFOREUSED + 20)) ] && \
-        error "after $AFTERUSED > before $BEFOREUSED" && return 5
+        error "after $AFTERUSED > before $BEFOREUSED"
     return 0
 }
 run_test 20b "write, unlink, eviction, replay, (test mds_cleanup_orphans)"
 
 test_20c() { # bug 10480
-    dd if=/dev/zero of=$DIR/$tfile bs=4k count=10000
-
-    exec 100< $DIR/$tfile
+    multiop $DIR/$tfile Ow_c &
+    pid=$!
+    # give multiop a chance to open
+    sleep 1
 
     ls -la $DIR/$tfile
 
@@ -523,8 +503,7 @@ test_20c() { # bug 10480
 
     df -P $DIR || df -P $DIR || true    # reconnect
 
-    exec 100<&-
-
+    kill -USR1 $pid
     test -s $DIR/$tfile || error "File was truncated"
 
     return 0
@@ -955,7 +934,7 @@ test_42() {
     createmany -o $DIR/$tfile-%d 800
     replay_barrier ost1
     unlinkmany $DIR/$tfile-%d 0 400
-    DEBUG42=`sysctl -n lnet.debug`
+    debugsave
     sysctl -w lnet.debug=-1
     facet_failover ost1
     
@@ -964,7 +943,7 @@ test_42() {
     #[ $blocks_after -lt $blocks ] || return 1
     echo wait for MDS to timeout and recover
     sleep $((TIMEOUT * 2))
-    sysctl -w lnet.debug="$DEBUG42"
+    debugrestore
     unlinkmany $DIR/$tfile-%d 400 400
     $CHECKSTAT -t file $DIR/$tfile-* && return 2 || true
 }
@@ -1089,9 +1068,10 @@ test_48() {
 run_test 48 "MDS->OSC failure during precreate cleanup (2824)"
 
 test_50() {
-    local oscdev=`grep ${ost1_svc}-osc-MDT0000 $LPROC/devices | awk '{print $1}'`
+    local oscdev=`do_facet $SINGLEMDS grep ${ost1_svc}-osc-MDT0000 $LPROC/devices | awk '{print $1}'`
     [ "$oscdev" ] || return 1
-    $LCTL --device $oscdev recover &&  $LCTL --device $oscdev recover
+    do_facet $SINGLEMDS $LCTL --device $oscdev recover || return 2
+    do_facet $SINGLEMDS $LCTL --device $oscdev recover || return 3
     # give the mds_lov_sync threads a chance to run
     sleep 5
 }
@@ -1157,12 +1137,11 @@ run_test 57 "test recovery from llog for setattr op"
 test_58() {
 #define OBD_FAIL_MDS_OST_SETATTR       0x12c
     do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x8000012c"
-    mkdir $DIR/$tdir
     createmany -o $DIR/$tdir/$tfile-%d 2500
     replay_barrier $SINGLEMDS
     fail $SINGLEMDS
     sleep 2
-    $CHECKSTAT -t file $DIR/$tdir/$tfile-* || return 1
+    $CHECKSTAT -t file $DIR/$tdir/$tfile-* >/dev/null || return 1
     do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x0"
     unlinkmany $DIR/$tdir/$tfile-%d 2500
     rmdir $DIR/$tdir
@@ -1172,7 +1151,6 @@ run_test 58 "test recovery from llog for setattr op (test llog_gen_rec)"
 # log_commit_thread vs filter_destroy race used to lead to import use after free
 # bug 11658
 test_59() {
-    mkdir $DIR/$tdir
     createmany -o $DIR/$tdir/$tfile-%d 200
     sync
     unlinkmany $DIR/$tdir/$tfile-%d 200
@@ -1189,7 +1167,6 @@ run_test 59 "test log_commit_thread vs filter_destroy race"
 # race between add unlink llog vs cat log init in post_recovery (only for b1_6)
 # bug 12086: should no oops and No ctxt error for this test
 test_60() {
-    mkdir $DIR/$tdir
     createmany -o $DIR/$tdir/$tfile-%d 200
     replay_barrier $SINGLEMDS
     unlinkmany $DIR/$tdir/$tfile-%d 0 100
@@ -1201,5 +1178,5 @@ test_60() {
 run_test 60 "test llog post recovery init vs llog unlink"
 
 equals_msg `basename $0`: test complete, cleaning up
-$CLEANUP
+check_and_cleanup_lustre
 [ -f "$TESTSUITELOG" ] && cat $TESTSUITELOG || true