Whamcloud - gitweb
b=20719
authorgrev <grev>
Wed, 14 Oct 2009 21:55:27 +0000 (21:55 +0000)
committergrev <grev>
Wed, 14 Oct 2009 21:55:27 +0000 (21:55 +0000)
i=Alexey.Lyashkov
i=Robert.Read
test_68a: load llite_loop if not loaded
module_loaded fn

lustre/tests/sanity.sh
lustre/tests/test-framework.sh

index 8e8ec18..ab53161 100644 (file)
@@ -3218,6 +3218,7 @@ test_66() {
 run_test 66 "update inode blocks count on client ==============="
 
 LLOOP=
+LLITELOOPLOAD=
 cleanup_68() {
        trap 0
        if [ ! -z "$LLOOP" ]; then
@@ -3229,6 +3230,10 @@ cleanup_68() {
                rm -f $LLOOP
                unset LLOOP
        fi
+       if [ ! -z "$LLITELOOPLOAD" ]; then
+               rmmod llite_lloop
+               unset LLITELOOPLOAD
+       fi 
        rm -f $DIR/f68*
 }
 
@@ -3244,15 +3249,21 @@ swap_used() {
 test_68a() {
        [ "$UID" != 0 ] && skip_env "must run as root" && return
 
-       grep -q llite_lloop /proc/modules
-       [ $? -ne 0 ] && skip "can't find module llite_lloop" && return
+       trap cleanup_68 EXIT
+
+       if ! module_loaded llite_lloop; then
+               if load_module llite/llite_lloop; then
+                       LLITELOOPLOAD=yes
+               else
+                       skip_env "can't find module llite_lloop"
+                       return
+               fi
+       fi
 
        LLOOP=$TMP/lloop.`date +%s`.`date +%N`
        dd if=/dev/zero of=$DIR/f68a bs=4k count=1024
        $LCTL blockdev_attach $DIR/f68a $LLOOP || error "attach failed"
 
-       trap cleanup_68 EXIT
-
        directio rdwr $LLOOP 0 1024 4096 || error "direct write failed"
        directio rdwr $LLOOP 0 1025 4096 && error "direct write should fail"
 
index c0c1bd9..6bd127a 100644 (file)
@@ -204,13 +204,20 @@ case `uname -r` in
     *) EXT=".ko"; USE_QUOTA=yes;;
 esac
 
+
+module_loaded () {
+   /sbin/lsmod | grep -q $1
+}
+
 load_module() {
     EXT=".ko"
     module=$1
     shift
     BASE=`basename $module $EXT`
-    lsmod | grep -q ${BASE} || \
-      if [ -f ${LUSTRE}/${module}${EXT} ]; then
+
+    module_loaded ${BASE} && return
+
+    if [ -f ${LUSTRE}/${module}${EXT} ]; then
         insmod ${LUSTRE}/${module}${EXT} $@
     else
         # must be testing a "make install" or "rpm" installation
@@ -966,7 +973,7 @@ cleanup_check() {
     [ "`lctl dl 2> /dev/null | wc -l`" -gt 0 ] && lctl dl && \
         echo "$0: lustre didn't clean up..." 1>&2 && return 202 || true
 
-    if [ "`/sbin/lsmod 2>&1 | egrep 'lnet|libcfs'`" ]; then
+    if module_loaded lnet || module_loaded libcfs; then
         echo "$0: modules still loaded..." 1>&2
         /sbin/lsmod 1>&2
         return 203
@@ -2418,7 +2425,7 @@ equals_msg() {
 
 log() {
     echo "$*"
-    lsmod | grep lnet > /dev/null || load_modules
+    module_loaded lnet || load_modules
 
     local MSG="$*"
     # Get rid of '