Whamcloud - gitweb
- test-frameworkize recovery-small.sh, and recovery-small.sh will
authorrread <rread>
Wed, 24 Dec 2003 01:38:20 +0000 (01:38 +0000)
committerrread <rread>
Wed, 24 Dec 2003 01:38:20 +0000 (01:38 +0000)
  now run in a local, single node mode by default.

- Add some tests for old bugs to recovery-small.sh. These tests were
  in the ltest/recovery scripts, but that is now unused.

- Move the OBD_FAIL funcs to test-framework.

- add the -v command line option for test scripts; it will print out
  the commands its executing on the nodes.

lustre/tests/cfg/local.sh
lustre/tests/recovery-small.sh
lustre/tests/test-framework.sh

index f9c5198..1e41cff 100644 (file)
@@ -1,12 +1,13 @@
 # oldstyle
 MDSNODE=${MDSNODE:-`hostname`}
 OSTNODE=${OSTNODE:-`hostname`}
+CLIENT=${CLIENT:-client}
 
 mds_HOST=${mds_HOST:-$MDSNODE}
 mdsfailover_HOST=${mdsfailover_HOST}
 ost_HOST=${ost_HOST:-$OSTNODE}
 ost2_HOST=${ost2_HOST:-$ost_HOST}
-client_HOST=${client_HOST:-"'*'"}
+client_HOST=${client_HOST:-$CLIENT}
 NETTYPE=${NETTYPE:-tcp}
 
 MOUNT=${MOUNT:-"/mnt/lustre"}
index cdd599f..cfe0375 100755 (executable)
 #!/bin/sh
 
-set -ex
+set -e
 
 LUSTRE=${LUSTRE:-`dirname $0`/..}
-LTESTDIR=${LTESTDIR:-$LUSTRE/../ltest}
-PATH=$PATH:$LUSTRE/utils:$LUSTRE/tests
+. $LUSTRE/tests/test-framework.sh
+
+init_test_env $@
 
-RLUSTRE=${RLUSTRE:-$LUSTRE}
-RPWD=${RPWD:-$PWD}
+. ${CONFIG:=$LUSTRE/tests/cfg/local.sh}
 
 . $LUSTRE/tests/test-framework.sh
 
+build_test_filter
+
+
 # Allow us to override the setup if we already have a mounted system by
 # setting SETUP=" " and CLEANUP=" "
 SETUP=${SETUP:-"setup"}
 CLEANUP=${CLEANUP:-"cleanup"}
 
-PDSH=${PDSH:-'pdsh -S -w'}
-
-# XXX I wish all this stuff was in some default-config.sh somewhere
-MDSNODE=${MDSNODE:-mdev6}
-OSTNODE=${OSTNODE:-mdev7}
-CLIENT=${CLIENT:-mdev8}
-NETWORKTYPE=${NETWORKTYPE:-tcp}
-MOUNTPT=${MOUNTPT:-/mnt/lustre}
-CONFIG=${CONFIG:-recovery-small.xml}
-MDSDEV=${MDSDEV:-/tmp/mds-`hostname`}
-MDSSIZE=${MDSSIZE:-100000}
-OSTDEV=${OSTDEV:-/tmp/ost-`hostname`}
-OSTSIZE=${OSTSIZE:-100000}
-UPCALL=${UPCALL:-$RPWD/recovery-small-upcall.sh}
-FSTYPE=${FSTYPE:-ext3}
-TIMEOUT=${TIMEOUT:-5}
-do_mds() {
-    $PDSH $MDSNODE "PATH=\$PATH:$RLUSTRE/utils:$RLUSTRE/tests; cd $RPWD; $@" || exit $?
-}
-
-do_client() {
-    $PDSH $CLIENT "PATH=\$PATH:$RLUSTRE/utils:$RLUSTRE/tests; cd $RPWD; $@"  || exit $?
-}
-
-do_ost() {
-    $PDSH $OSTNODE "PATH=\$PATH:$RLUSTRE/utils:$RLUSTRE/tests; cd $RPWD; $@" || exit $?
-}
-
-drop_request() {
-# OBD_FAIL_MDS_ALL_REQUEST_NET
-    do_mds "echo 0x123 > /proc/sys/lustre/fail_loc"
-    do_client "$1"
-    do_mds "echo 0 > /proc/sys/lustre/fail_loc"
-}
 
-drop_reply() {
-# OBD_FAIL_MDS_ALL_REPLY_NET
-    do_mds "echo 0x122 > /proc/sys/lustre/fail_loc"
-    do_client "$@"
-    do_mds "echo 0 > /proc/sys/lustre/fail_loc"
-}
-
-pause_bulk() {
-#define OBD_FAIL_OST_BRW_PAUSE_BULK      0x214
-    do_ost "echo 0x214 > /proc/sys/lustre/fail_loc"
-    do_client "$1"
-    do_client "sync"
-    do_ost "echo 0 > /proc/sys/lustre/fail_loc"
-}
 make_config() {
-    rm -f $CONFIG
-    for NODE in $CLIENT $MDSNODE $OSTNODE; do
-       lmc -m $CONFIG --add net --node $NODE --nid `h2$NETWORKTYPE $NODE` \
-           --nettype $NETWORKTYPE || exit 4
-    done
-    lmc -m $CONFIG --add mds --node $MDSNODE --mds mds1 --dev $MDSDEV \
-        --size $MDSSIZE --fstype $FSTYPE || exit 5
-    lmc -m $CONFIG --add lov --lov lov1 --mds mds1 --stripe_sz 65536 \
-       --stripe_cnt 0 --stripe_pattern 0 || exit 6 
-    lmc -m $CONFIG --add ost --nspath /mnt/ost_ns --node $OSTNODE \
-       --lov lov1 --dev $OSTDEV --size $OSTSIZE --fstype $FSTYPE || exit 7
-    lmc -m $CONFIG --add mtpt --node $CLIENT --path $MOUNTPT --mds mds1 \
-        --lov lov1 || exit 8
-}
-
-start_mds() {
-    do_mds "lconf $@ $CONFIG"
-}
-
-shutdown_mds() {
-    do_mds "lconf $@ --cleanup $CONFIG"
-}
-
-start_ost() {
-    do_ost "lconf $@ $CONFIG"
-}
-
-shutdown_ost() {
-    do_ost "lconf $@ --cleanup $CONFIG"
-}
-
-mount_client() {
-    do_client "lconf $@ $CONFIG"
-}
-
-unmount_client() {
-    do_client "lconf $@ --cleanup $CONFIG"
+    rm -f $XMLCONFIG
+    add_mds mds --dev $MDSDEV --size $MDSSIZE
+    add_lov lov1 mds --stripe_sz $STRIPE_BYTES\
+       --stripe_cnt $STRIPES_PER_OBJ --stripe_pattern 0
+    add_ost ost --lov lov1 --dev $OSTDEV --size $OSTSIZE
+    add_ost ost2 --lov lov1 --dev ${OSTDEV}-2 --size $OSTSIZE
+    add_client client mds --lov lov1 --path $MOUNT
 }
 
 setup() {
-    start_ost --timeout=$TIMEOUT ${REFORMAT}
-    start_mds --timeout=$TIMEOUT ${REFORMAT}
-    # XXX we should write our own upcall, when we move this somewhere better.
-    mount_client --timeout=${TIMEOUT} \
-        --lustre_upcall=$UPCALL
+    make_config
+    start ost --reformat $OSTLCONFARGS 
+    start ost2 --reformat $OSTLCONFARGS 
+    [ "$DAEMONFILE" ] && $LCTL debug_daemon start $DAEMONFILE $DAEMONSIZE
+    start mds $MDSLCONFARGS --reformat
+    zconf_mount $MOUNT
 }
 
 cleanup() {
-    do_mds "echo 0 > /proc/sys/lustre/fail_loc"
-    unmount_client $@ || exit 97
-    shutdown_mds $@ || exit 98
-    shutdown_ost $@ || exit 99
+    zconf_umount $MOUNT
+    stop mds ${FORCE} $MDSLCONFARGS
+    stop ost2 ${FORCE} --dump cleanup.log
+    stop ost ${FORCE} --dump cleanup.log
 }
 
 replay() {
@@ -127,45 +53,88 @@ replay() {
     shutdown_mds -f
     start_mds
     wait
-    do_client "df -h $MOUNTPT" # trigger failover, if we haven't already
+    do_client "df -h $MOUNT" # trigger failover, if we haven't already
 }
 
-if [ ! -z "$ONLY" ]; then
-    eval "$ONLY"
+if [ ! -z "$EVAL" ]; then
+    eval "$EVAL"
     exit $?
 fi
 
-make_config
-
 REFORMAT=--reformat $SETUP
 unset REFORMAT
 
-drop_request "mcreate /mnt/lustre/1"
-drop_reply "mcreate /mnt/lustre/2"
-# replay "mcreate /mnt/lustre/3"
+test_1() {
+    drop_request "mcreate $MOUNT/1"  || return 1
+    drop_reply "mcreate $MOUNT/2"    || return 2
+}
+run_test 1 "mcreate: drop req, drop rep"
 
-drop_request "tchmod 111 /mnt/lustre/2"
-drop_reply "tchmod 666 /mnt/lustre/2"
-# replay "tchmod 444 /mnt/lustre/2"
+test_2() {
+    drop_request "tchmod 111 $MOUNT/2"  || return 1
+    drop_reply "tchmod 666 $MOUNT/2"    || return 2
+}
+run_test 2 "chmod: drop req, drop rep"
+
+test_3() {
+    drop_request "statone $MOUNT/2" || return 1
+    drop_reply "statone $MOUNT/2"   || return 2
+}
+run_test 3 "stat: drop req, drop rep"
 
-drop_request "statone /mnt/lustre/2"
-drop_reply "statone /mnt/lustre/2"
-# replay "statone /mnt/lustre/2"
+test_4() {
+    do_facet client "cp /etc/resolv.conf $MOUNT/resolv.conf" || return 1
+    drop_request "cat $MOUNT/resolv.conf > /dev/null"   || return 2
+    drop_reply "cat $MOUNT/resolv.conf > /dev/null"     || return 3
+}
+run_test 4 "open: drop req, drop rep"
 
-do_client "cp /etc/resolv.conf /mnt/lustre/resolv.conf"
-drop_request "cat /mnt/lustre/resolv.conf > /dev/null"
-drop_reply "cat /mnt/lustre/resolv.conf > /dev/null"
+test_5() {
+    drop_request "mv $MOUNT/resolv.conf $MOUNT/renamed" || return 1
+    drop_reply "mv $MOUNT/renamed $MOUNT/renamed-again" || return 2
+}
+run_test 5 "rename: drop req, drop rep"
 
-drop_request "mv /mnt/lustre/resolv.conf /mnt/lustre/renamed"
-drop_reply "mv /mnt/lustre/renamed /mnt/lustre/renamed-again"
+test_6() {
+    drop_request "mlink $MOUNT/renamed-again $MOUNT/link1" || return 1
+    drop_reply "mlink $MOUNT/renamed-again $MOUNT/link2"   || return 2
+}
+run_test 6 "link: drop req, drop rep"
 
-drop_request "mlink /mnt/lustre/renamed-again /mnt/lustre/link1"
-drop_reply "mlink /mnt/lustre/renamed-again /mnt/lustre/link2"
+test_7() {
+    drop_request "munlink $MOUNT/link1"   || return 1
+    drop_reply "munlink $MOUNT/link2"     || return 2
+}
+run_test 7 "unlink: drop req, drop rep"
 
-drop_request "munlink /mnt/lustre/link1"
-drop_reply "munlink /mnt/lustre/link2"
 
 #bug 1423
-drop_reply "touch /mnt/lustre/renamed"
+test_8() {
+    drop_reply "touch $MOUNT/renamed"    || return 1
+}
+run_test 8 "touch: drop rep (bug 1423)"
+
+
+#bug 1420
+test_9() {
+    pause_bulk "cp /etc/profile $MOUNT"       || return 1
+    do_facet client "cp /etc/termcap $MOUNT"  || return 2
+    do_facet client "sync"
+    do_facet client "rm $MOUNT/termcap $MOUNT/profile" || return 3
+}
+run_test 9 "pause bulk on OST (bug 1420)"
+
+#bug 1521
+test_10() {
+    do_facet client mcreate $MOUNT/f10        || return 1
+    drop_bl_callback "chmod 0777 $MOUNT/f10"  || return 2
+    # wait for the mds to evict the client
+    #echo "sleep $(($TIMEOUT*2))"
+    #sleep $(($TIMEOUT*2))
+    do_facet client touch  $MOUNT/f10 || echo "touch failed, evicted"
+    do_facet client checkstat -v -p 0777 $MOUNT/f10  || return 3
+    do_facet client "unlink $MOUNT/f10"
+}
+run_test 10 "finish request after client eviction (bug 1521)"
 
 $CLEANUP
index 49d005c..610c268 100644 (file)
@@ -41,10 +41,11 @@ init_test_env() {
 
     # command line
     
-    while getopts "rf:" opt $*; do 
+    while getopts "rvf:" opt $*; do 
        case $opt in
            f) CONFIG=$OPTARG;;
            r) REFORMAT=--reformat;;
+           v) VERBOSE=true;;
            \?) usage;;
        esac
     done
@@ -244,6 +245,10 @@ change_active() {
 do_node() {
     HOST=$1
     shift
+
+    if $VERBOSE; then
+       echo "CMD $HOST $@"
+    fi
     $PDSH $HOST "(PATH=\$PATH:$RLUSTRE/utils:$RLUSTRE/tests; cd $RPWD; sh -c \"$@\")"
 }
 do_facet() {
@@ -354,6 +359,46 @@ absolute_path() {
 }
 
 ##################################
+# OBD_FAIL funcs
+
+drop_request() {
+# OBD_FAIL_MDS_ALL_REQUEST_NET
+    RC=0
+    do_facet mds "echo 0x123 > /proc/sys/lustre/fail_loc"
+    do_facet client "$1" || RC=$?
+    do_facet mds "echo 0 > /proc/sys/lustre/fail_loc"
+    return $RC
+}
+
+drop_reply() {
+# OBD_FAIL_MDS_ALL_REPLY_NET
+    RC=0
+    do_facet mds "echo 0x122 > /proc/sys/lustre/fail_loc"
+    do_facet client "$@" || RC=$?
+    do_facet mds "echo 0 > /proc/sys/lustre/fail_loc"
+    return $RC
+}
+
+pause_bulk() {
+#define OBD_FAIL_OST_BRW_PAUSE_BULK      0x214
+    RC=0
+    do_facet ost "echo 0x214 > /proc/sys/lustre/fail_loc"
+    do_facet client "$1" || RC=$?
+    do_facet client "sync"
+    do_facet ost "echo 0 > /proc/sys/lustre/fail_loc"
+    return $RC
+}
+
+drop_bl_callback() {
+#define OBD_FAIL_LDLM_BL_CALLBACK        0x305
+    RC=0
+    do_facet client "echo 0x305 > /proc/sys/lustre/fail_loc"
+    do_facet client "$@" || RC=$?
+    do_facet client "echo 0 > /proc/sys/lustre/fail_loc"
+    return $RC
+}
+
+##################################
 # Test interface 
 error() {
     echo "${TESTSUITE}: **** FAIL:" $@