Whamcloud - gitweb
b=2623
authornic <nic>
Fri, 6 Feb 2004 02:20:29 +0000 (02:20 +0000)
committernic <nic>
Fri, 6 Feb 2004 02:20:29 +0000 (02:20 +0000)
r=ccooper

Fix problem where none of the tests were checking for a successfull cleanup.
Error in cleanup when modules are still loaded.

lustre/tests/conf-sanity.sh

index 2411b35..39e92a9 100644 (file)
@@ -18,6 +18,12 @@ init_test_env $@
 
 FORCE=${FORCE:-" --force"}
 
 
 FORCE=${FORCE:-" --force"}
 
+if [ "$VERBOSE" == "true" ]; then
+       CMDVERBOSE=""
+else
+       CMDVERBOSE=" > /dev/null"
+fi
+
 gen_config() {
        rm -f $XMLCONFIG
 
 gen_config() {
        rm -f $XMLCONFIG
 
@@ -40,33 +46,33 @@ gen_second_config() {
 
 start_mds() {
        echo "start mds service on `facet_active_host mds`"
 
 start_mds() {
        echo "start mds service on `facet_active_host mds`"
-       start mds --reformat $MDSLCONFARGS > /dev/null || return 94
+       start mds --reformat $MDSLCONFARGS $CMDVERBOSE || return 94
 }
 stop_mds() {
        echo "stop mds service on `facet_active_host mds`"
 }
 stop_mds() {
        echo "stop mds service on `facet_active_host mds`"
-       stop mds $@ > /dev/null || return 97 
+       stop mds $@ $CMDVERBOSE || return 97 
 }
 
 start_ost() {
        echo "start ost service on `facet_active_host ost`"
 }
 
 start_ost() {
        echo "start ost service on `facet_active_host ost`"
-       start ost --reformat $OSTLCONFARGS > /dev/null || return 95
+       start ost --reformat $OSTLCONFARGS $CMDVERBOSE || return 95
 }
 
 stop_ost() {
        echo "stop ost service on `facet_active_host ost`"
 }
 
 stop_ost() {
        echo "stop ost service on `facet_active_host ost`"
-       stop ost $@ > /dev/null || return 98 
+       stop ost $@ $CMDVERBOSE || return 98 
 }
 
 mount_client() {
        local MOUNTPATH=$1
        echo "mount lustre on ${MOUNTPATH}....."
 }
 
 mount_client() {
        local MOUNTPATH=$1
        echo "mount lustre on ${MOUNTPATH}....."
-       zconf_mount $MOUNTPATH > /dev/null || return 96
+       zconf_mount $MOUNTPATH $CMDVERBOSE || return 96
 }
 
 umount_client() {
        local MOUNTPATH=$1
        echo "umount lustre on ${MOUNTPATH}....."
 }
 
 umount_client() {
        local MOUNTPATH=$1
        echo "umount lustre on ${MOUNTPATH}....."
-       zconf_umount $MOUNTPATH > /dev/null || return 97
+       zconf_umount $MOUNTPATH $CMDVERBOSE || return 97
 }
 
 manual_umount_client(){
 }
 
 manual_umount_client(){
@@ -81,9 +87,15 @@ setup() {
 }
 
 cleanup() {
 }
 
 cleanup() {
-       umount_client $MOUNT || return -200
-       stop_mds  || return -201
-       stop_ost || return -202
+       umount_client $MOUNT || return 200
+       stop_mds  || return 201
+       stop_ost || return 202
+       # catch case where these return just fine, but modules are still not unloaded
+       /sbin/lsmod | grep -q portals 
+       if [ 1 -ne $? ]; then
+               echo "modules still loaded..."
+               return 203
+       fi
 }
 
 check_mount() {
 }
 
 check_mount() {
@@ -112,18 +124,18 @@ test_0() {
        start_mds       
        mount_client $MOUNT  
        check_mount || return 41
        start_mds       
        mount_client $MOUNT  
        check_mount || return 41
-       cleanup  
+       cleanup || return $?
 }
 run_test 0 "single mount setup"
 
 test_1() {
        start_ost
        echo "start ost second time..."
 }
 run_test 0 "single mount setup"
 
 test_1() {
        start_ost
        echo "start ost second time..."
-       start ost --reformat $OSTLCONFARGS > /dev/null 
+       start ost --reformat $OSTLCONFARGS $CMDVERBOSE 
        start_mds       
        mount_client $MOUNT
        check_mount || return 42
        start_mds       
        mount_client $MOUNT
        check_mount || return 42
-       cleanup 
+       cleanup || return $?
 }
 run_test 1 "start up ost twice"
 
 }
 run_test 1 "start up ost twice"
 
@@ -131,11 +143,11 @@ test_2() {
        start_ost
        start_mds       
        echo "start mds second time.."
        start_ost
        start_mds       
        echo "start mds second time.."
-       start mds --reformat $MDSLCONFARGS > /dev/null 
+       start mds --reformat $MDSLCONFARGS $CMDVERBOSE 
        
        mount_client $MOUNT  
        check_mount || return 43
        
        mount_client $MOUNT  
        check_mount || return 43
-       cleanup 
+       cleanup || return $?
 }
 run_test 2 "start up mds twice"
 
 }
 run_test 2 "start up mds twice"
 
@@ -146,7 +158,7 @@ test_3() {
        check_mount || return 44
        
        umount_client $MOUNT    
        check_mount || return 44
        
        umount_client $MOUNT    
-       cleanup  
+       cleanup  || return $?
 }
 run_test 3 "mount client twice"
 
 }
 run_test 3 "mount client twice"
 
@@ -154,13 +166,12 @@ test_4() {
        setup
        touch $DIR/$tfile || return 85
        stop_ost ${FORCE}
        setup
        touch $DIR/$tfile || return 85
        stop_ost ${FORCE}
-
-       # cleanup may return an error from the failed 
-       # disconnects; for now I'll consider this successful 
-       # if all the modules have unloaded.
-       if ! cleanup ; then
-           lsmod | grep -q portals && return 1
-        fi
+       cleanup 
+       eno=$?
+       # ok for ost to fail shutdown
+       if [ 202 -ne $eno ]; then
+               return $eno;
+       fi
        return 0
 }
 run_test 4 "force cleanup ost, then cleanup"
        return 0
 }
 run_test 4 "force cleanup ost, then cleanup"
@@ -169,13 +180,12 @@ test_5() {
        setup
        touch $DIR/$tfile || return 86
        stop_mds ${FORCE} || return 98
        setup
        touch $DIR/$tfile || return 86
        stop_mds ${FORCE} || return 98
-
-       # cleanup may return an error from the failed 
-       # disconnects; for now I'll consider this successful 
-       # if all the modules have unloaded.
-       if ! cleanup ; then
-           lsmod | grep -q portals && return 1
-        fi
+       cleanup 
+       eno=$?
+       # ok for mds to fail shutdown
+       if [ 201 -ne $eno ]; then
+               return $eno;
+       fi
        return 0
 }
 run_test 5 "force cleanup mds, then cleanup"
        return 0
 }
 run_test 5 "force cleanup mds, then cleanup"
@@ -185,14 +195,14 @@ test_6() {
        manual_umount_client
        mount_client ${MOUNT} || return 87
        touch $DIR/a || return 86
        manual_umount_client
        mount_client ${MOUNT} || return 87
        touch $DIR/a || return 86
-       cleanup 
+       cleanup  || return $?
 }
 run_test 6 "manual umount, then mount again"
 
 test_7() {
        setup
        manual_umount_client
 }
 run_test 6 "manual umount, then mount again"
 
 test_7() {
        setup
        manual_umount_client
-       cleanup 
+       cleanup || return $?
 }
 run_test 7 "manual umount, then cleanup"
 
 }
 run_test 7 "manual umount, then cleanup"
 
@@ -241,7 +251,7 @@ test_9() {
            return 1
         fi
         check_mount || return 41
            return 1
         fi
         check_mount || return 41
-        cleanup
+        cleanup || return $?
 
         # the new PTLDEBUG/SUBSYSTEM used for lconf --ptldebug/subsystem
         PTLDEBUG="inode+trace"
 
         # the new PTLDEBUG/SUBSYSTEM used for lconf --ptldebug/subsystem
         PTLDEBUG="inode+trace"
@@ -266,7 +276,7 @@ test_9() {
         fi
         mount_client $MOUNT
         check_mount || return 41
         fi
         mount_client $MOUNT
         check_mount || return 41
-        cleanup
+        cleanup || return $?
 
         # resume the old configuration
         PTLDEBUG=$OLDPTLDEBUG
 
         # resume the old configuration
         PTLDEBUG=$OLDPTLDEBUG