Whamcloud - gitweb
Update the new test configuration stuff to use the newly implemented obdctl
authoradilger <adilger>
Wed, 24 Apr 2002 06:07:15 +0000 (06:07 +0000)
committeradilger <adilger>
Wed, 24 Apr 2002 06:07:15 +0000 (06:07 +0000)
features (newdev, name2dev FOO, and setup $FOO).  Also changed the "runtests"
script over to using the new configuration setup so that it is easier to run
with both ext2/ext3 MDS and obdext2/obdfilter OBDs.

lustre/tests/common.sh
lustre/tests/llmountcleanup.sh
lustre/tests/llrsetup.sh [new file with mode: 0644]
lustre/tests/mds.cfg
lustre/tests/runtests

index bdd9ed1..f8cd485 100644 (file)
@@ -7,7 +7,7 @@ PORTALS=$SRCDIR/../../portals
 LUSTRE=$SRCDIR/../../obd
 
 PTLCTL=$PORTALS/linux/utils/ptlctl
-DEBCTL=$PORTALS/linux/utils/debugctl
+DBGCTL=$PORTALS/linux/utils/debugctl
 ACCEPTOR=$PORTALS/linux/utils/acceptor
 
 OBDCTL=$LUSTRE/utils/obdctl
@@ -63,7 +63,7 @@ new_fs () {
                        echo "usage: $0 <fstype> <file> <size>" 1>&2 && exit -1
 
                if [ -r "$EFILE" ]; then
-                       echo "using existing filesystem $EFILE for $2"
+                       echo "using prepared filesystem $EFILE for $2"
                        zcat "$EFILE" > $2 || exit -1
                        sync
                else
@@ -91,7 +91,7 @@ old_fs () {
 }
 
 list_mods() {
-       $DEBCTL modules > $R/tmp/ogdb
+       $DBGCTL modules > $R/tmp/ogdb
        echo "The GDB module script is in /tmp/ogdb"
 }
 
@@ -199,7 +199,14 @@ setup_ldlm() {
         read
 }
 
-DEVNO=0; export DEVNO
+find_devno() {
+       if [ -z "$1" ]; then
+               echo "usage: $0 <devname>" 1>&2
+               return -1
+       fi
+
+       $OBDCTL name2dev $1
+}
 
 setup_mds() {
        [ "$SETUP_MDS" = "y" ] || return 0
@@ -215,13 +222,11 @@ setup_mds() {
                return -1
        fi
 
-       $1 ${MDSFS} ${MDSDEV} ${MDSSIZE}
+       $DO_FS ${MDSFS} ${MDSDEV} ${MDSSIZE}
        MDS=${LOOPDEV}
 
-       MDS_DEVNO=$DEVNO; DEVNO=`expr $DEVNO + 1`
-       
        $OBDCTL <<- EOF
-       device ${MDS_DEVNO}
+       newdev
        attach mds MDSDEV
        setup ${MDS} ${MDSFS}
        quit
@@ -268,16 +273,13 @@ setup_ost() {
                OBD=${LOOPDEV}
        fi
 
-       OBD_DEVNO=$DEVNO; DEVNO=`expr $DEVNO + 1`
-       OST_DEVNO=$DEVNO; DEVNO=`expr $DEVNO + 1`
-
        $OBDCTL <<- EOF
-       device ${OBD_DEVNO}
+       newdev
        attach ${OSTTYPE} OBDDEV
        setup ${OBD} ${OBDARG}
-       device ${OST_DEVNO}
+       newdev
        attach ost OSTDEV
-       setup ${OBD_DEVNO}
+       setup \$OBDDEV
        quit
        EOF
 }
@@ -286,16 +288,20 @@ setup_server() {
        setup_mds $1 && setup_ost $1
 }
 
+setup_rpc() {
+       $OBDCTL <<- EOF || return $rc
+       newdev
+       attach ptlrpc RPCDEV
+       setup
+       quit
+       EOF
+}
+
 setup_osc() {
        [ "$SETUP_OSC" != "y" ] && return 0
 
-       RPC_DEVNO=$DEVNO; DEVNO=`expr $DEVNO + 1`
-       OSC_DEVNO=$DEVNO; DEVNO=`expr $DEVNO + 1`
        $OBDCTL <<- EOF || return $rc
-       device ${RPC_DEVNO}
-       attach ptlrpc RPCDEV
-       setup
-       device ${OSC_DEVNO}
+       newdev
        attach osc OSCDEV
        setup -1
        quit
@@ -311,11 +317,11 @@ setup_mount() {
        fi
 
        [ ! -d $OSCMT ] && mkdir $OSCMT
-       mount -t lustre_lite -o device=$OSC_DEVNO none $OSCMT
+       mount -t lustre_lite -o device=`find_devno OSCDEV` none $OSCMT
 }
 
 setup_client() {
-       setup_osc && setup_mount
+       setup_rpc && setup_osc && setup_mount
 }
 
 DEBUG_ON="echo 0xffffffff > /proc/sys/portals/debug"
@@ -380,58 +386,82 @@ cleanup_lustre() {
 cleanup_mds() {
        [ "$SETUP" -a -z "$SETUP_MDS" ] && return 0
 
-       [ "$SETUP" ] || MDS_DEVNO=0
-
-       $OBDCTL <<- EOF
-       name2dev MDSDEV
-       cleanup
-       detach
-       quit
-       EOF
+       MDSDEVNO=`find_devno MDSDEV`
+       if [ "$MDSDEVNO" ]; then
+               $OBDCTL <<- EOF
+               device $MDSDEVNO
+               cleanup
+               detach
+               quit
+               EOF
+       fi
 }
 
 cleanup_ost() {
        [ "$SETUP" -a -z "$SETUP_OST" ] && return 0
 
-       $OBDCTL <<- EOF
-       name2dev OSTDEV
-       cleanup
-       detach
-       name2dev OBDDEV
-       cleanup
-       detach
-       quit
-       EOF
+       OSTDEVNO=`find_devno OSTDEV`
+       if [ "$OSTDEVNO" ]; then
+               $OBDCTL <<- EOF
+               device $OSTDEVNO
+               cleanup
+               detach
+               quit
+               EOF
+       fi
+
+       OBDDEVNO=`find_devno OBDDEV`
+       if [ "$OBDDEVNO" ]; then
+               $OBDCTL <<- EOF
+               device $OBDDEVNO
+               cleanup
+               detach
+               quit
+               EOF
+       fi
 }
 
 cleanup_server() {
        cleanup_ost && cleanup_mds
-       DEVNO=0
 }
 
 cleanup_mount() {
        [ "$SETUP" -a -z "$SETUP_MOUNT" ] && return 0
 
        [ "$OSCMT" ] || OSCMT=/mnt/lustre
-       umount $OSCMT || fail "unable to unmount $OSCMT"
+       if [ "`mount | grep $OSCMT`" ]; then
+               umount $OSCMT || fail "unable to unmount $OSCMT"
+       fi
 }
 
 cleanup_osc() {
        [ "$SETUP" -a -z "$SETUP_OSC" ] && return 0
 
-       [ "$SETUP" ] || OSC_DEVNO=3
+       OSCDEVNO=`find_devno OSCDEV`
+       if [ "$OSCDEVNO" ]; then
+               $OBDCTL <<- EOF
+               device $OSCDEVNO
+               cleanup
+               detach
+               quit
+               EOF
+       fi
+}
 
-       $OBDCTL <<- EOF
-       name2dev OSCDEV
-       cleanup
-       detach
-       quit
-       EOF
+cleanup_rpc() {
+       RPCDEVNO=`find_devno RPCDEV`
+       if [ "$RPCDEVNO" ]; then
+               $OBDCTL <<- EOF
+               device $RPCDEVNO
+               cleanup
+               detach
+               quit
+               EOF
+       fi
 }
 
 cleanup_client() {
-       cleanup_mount && cleanup_osc
-       DEVNO=0
+       cleanup_mount && cleanup_osc && cleanup_rpc
 }
 
 fail() { 
index 69d7f75..bb95d45 100755 (executable)
@@ -3,7 +3,7 @@
 SRCDIR="`dirname $0`"
 . $SRCDIR/common.sh
 
-$DEBCTL get_debug > /tmp/debug
+$DBGCTL get_debug > /tmp/debug.1
 
 if [ "`mount | grep '/mnt/lustre'`" ]; then
        umount /mnt/lustre || fail "cannot unmount"
@@ -45,6 +45,8 @@ rmmod ldlm
 rmmod ptlrpc
 rmmod obdclass
 
+$DBGCTL get_debug > /tmp/debug.2
+
 $PTLCTL <<EOF
 setup tcp
 disconnect
diff --git a/lustre/tests/llrsetup.sh b/lustre/tests/llrsetup.sh
new file mode 100644 (file)
index 0000000..026619e
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+SRCDIR="`dirname $0`"
+. $SRCDIR/common.sh
+
+setup_opts "$@"
+
+setup_portals
+setup_lustre
+
+setup_server old_fs
+setup_client
index 104e586..7807b33 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/sh
 # Config file for setting up a metadata server
-MDSFS=ext2
+MDSFS=ext3
 MDSDEV=/tmp/mds
 MDSSIZE=10000
 SETUP_MDS=y
index de9bad9..06ed91a 100755 (executable)
@@ -4,49 +4,51 @@
 # Probably a good idea to run this before doing any checkins.
 # In the future this can become more fancy, but it's OK for now.
 
-RUNDIR=`dirname $0`
+SRCDIR="`dirname $0`"
 
-PATH=$PATH:$RUNDIR
+export PATH=/sbin:/usr/sbin:$SRCDIR:$PATH
+
+. $SRCDIR/common.sh
 
 ERROR=
 
-[ "`mount | grep /mnt/lustre`" ] || echo | sh llmount.sh || exit 1
+[ "`mount | grep /mnt/lustre`" ] || echo | sh llsetup.sh $@ || exit 1
 
 # let's start slowly here...
-touch /mnt/lustre || exit 2
-cp /etc/hosts /mnt/lustre || exit 3
-diff -u /etc/hosts /mnt/lustre/hosts || exit 4
+touch /mnt/lustre || fail "can't touch /mnt/lustre" 2
+cp /etc/hosts /mnt/lustre || fail "can't cp /etc/hosts" 3
+diff -u /etc/hosts /mnt/lustre/hosts || fail "/etc/hosts copy different" 4
 
 # ok, that hopefully worked, so let's do a little more
 FILES=`find /etc -type f`
 echo "copying files from /etc to /mnt/lustre"
-tar cf - $FILES | tar xf - -C /mnt/lustre || exit 10
+tar cf - $FILES | tar xf - -C /mnt/lustre || fail "copying /etc" 10
 
 echo "comparing newly copied files"
 for f in $FILES; do
        diff -q $f /mnt/lustre/$f || ERROR=11
 done
 
-[ "$ERROR" ] && exit $ERROR
+[ "$ERROR" ] && fail "old and new files are different" 11
 
-sh llmountcleanup.sh
+sh llcleanup.sh $@
 
-echo | sh llrmount.sh || exit 20
+echo | sh llrsetup.sh $@ || exit 20
 echo "comparing previously copied files"
-diff -u /etc/hosts /mnt/lustre/hosts || exit 21
+diff -u /etc/hosts /mnt/lustre/hosts || fail "/etc/hosts is now different" 21
 
 for f in $FILES; do
        diff -q $f /mnt/lustre/$f || ERROR=22
 done
 
-[ "$ERROR" ] && exit $ERROR
+[ "$ERROR" ] && fail "old and new files are different on second diff" 23
 
-sh llmountcleanup.sh
-echo | sh llrmount.sh || exit 24
+sh llcleanup.sh $@
+echo | sh llrsetup.sh $@ || exit 24
 
 echo "removing files from /mnt/lustre/etc"
-rm /mnt/lustre/hosts || exit 25
+rm /mnt/lustre/hosts || fail "can't remove /mnt/lustre/hosts" 25
 
-rm -r /mnt/lustre/etc || exit 26
+rm -r /mnt/lustre/etc || fail "can't remove /mnt/lustre/etc" 26
 
-sh llmountcleanup.sh
+sh llcleanup.sh $@