Whamcloud - gitweb
LU-8832 tests: fix module loading for Parallels 60/25660/5
authorAndreas Dilger <andreas.dilger@intel.com>
Mon, 27 Feb 2017 10:54:28 +0000 (03:54 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Sun, 23 Apr 2017 03:10:52 +0000 (03:10 +0000)
It isn't possible to insmod modules directly from Parallels prl_fs
mounting a host filesystem when testing directly from a build tree
(insmod from an RPM installed in the root image filesystem works).
Instead, copy the locally-built module into /tmp before loading it.

Use load_module() in sanity.sh test_180b and run-llog.sh.

Test-Parameters: trivial
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Change-Id: Id0123059e8151e2a78086579150f04b1b05cab07
Reviewed-on: https://review.whamcloud.com/25660
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: James Nunez <james.a.nunez@intel.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/tests/run-llog.sh
lustre/tests/sanity.sh
lustre/tests/test-framework.sh

index 937daee..7c34dc6 100644 (file)
@@ -5,19 +5,6 @@ LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
 init_test_env $@
 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
 
 init_test_env $@
 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
 
-load_llog_test() {
-    grep -q llog_test /proc/modules && return
-    # Module should have been placed with other lustre modules...
-    modprobe llog_test 2>&1 | grep -v "llog_test not found"
-    grep -q llog_test /proc/modules && return
-    # But maybe we're running from a developer tree...
-    insmod $LUSTRE/obdclass/llog_test.ko
-    grep -q llog_test /proc/modules && return
-    echo "Unable to load llog_test module!"
-    false
-    return
-}
-
 PATH=$(dirname $0):$LUSTRE/utils:$PATH
 TMP=${TMP:-/tmp}
 
 PATH=$(dirname $0):$LUSTRE/utils:$PATH
 TMP=${TMP:-/tmp}
 
@@ -25,7 +12,7 @@ set -x
 MGS=$($LCTL dl | awk '/mgs/ { print $4 }')
 [ -z "$MGS" ] && echo "$0: SKIP: no MGS available, skipping llog test" && exit 0
 
 MGS=$($LCTL dl | awk '/mgs/ { print $4 }')
 [ -z "$MGS" ] && echo "$0: SKIP: no MGS available, skipping llog test" && exit 0
 
-load_llog_test || exit 0
+load_module obdclass/llog_test || exit 0
 $LCTL modules > $TMP/ogdb-$(hostname)
 echo "NOW reload debugging syms.."
 
 $LCTL modules > $TMP/ogdb-$(hostname)
 echo "NOW reload debugging syms.."
 
index 005aa8f..f432e35 100755 (executable)
@@ -11632,12 +11632,11 @@ test_180b() {
        local rc=0
        local rmmod_remote=0
 
        local rc=0
        local rmmod_remote=0
 
-       do_facet ost1 "lsmod | grep -q obdecho || "                      \
-                     "{ insmod ${LUSTRE}/obdecho/obdecho.ko || "        \
-                     "modprobe obdecho; }" && rmmod_remote=1
+       do_rpc_nodes $(facet_active_host ost1) load_module obdecho/obdecho &&
+               rmmod_remote=true || error "failed to load module obdecho"
        target=$(do_facet ost1 $LCTL dl | awk '/obdfilter/ {print $4;exit}')
        [[ -n $target ]] && { obdecho_test $target ost1 || rc=1; }
        target=$(do_facet ost1 $LCTL dl | awk '/obdfilter/ {print $4;exit}')
        [[ -n $target ]] && { obdecho_test $target ost1 || rc=1; }
-       [ $rmmod_remote -eq 1 ] && do_facet ost1 "rmmod obdecho"
+       $rmmod_remote && do_facet ost1 "rmmod obdecho"
        return $rc
 }
 run_test 180b "test obdecho directly on obdfilter"
        return $rc
 }
 run_test 180b "test obdecho directly on obdfilter"
index 8a33852..6ed34d0 100755 (executable)
@@ -442,6 +442,33 @@ module_loaded () {
        /sbin/lsmod | grep -q "^\<$1\>"
 }
 
        /sbin/lsmod | grep -q "^\<$1\>"
 }
 
+PRLFS=false
+lustre_insmod() {
+       local module=$1
+       shift
+       local args="$@"
+       local msg
+       local rc=0
+
+       if ! $PRLFS; then
+               msg="$(insmod $module $args 2>&1)" && return 0 || rc=$?
+       fi
+
+       # parallels can't load modules directly from prlfs, use /tmp instead
+       if $PRLFS || [[ "$(stat -f -c%t $module)" == "7c7c6673" ]]; then
+               local target="$(mktemp)"
+
+               cp "$module" "$target"
+               insmod $target $args
+               rc=$?
+               [[ $rc == 0 ]] && PRLFS=true
+               rm -f $target
+       else
+               echo "$msg"
+       fi
+       return $rc
+}
+
 # Load a module on the system where this is running.
 #
 # usage: load_module module_name [module arguments for insmod/modprobe]
 # Load a module on the system where this is running.
 #
 # usage: load_module module_name [module arguments for insmod/modprobe]
@@ -494,10 +521,10 @@ load_module() {
        # we're passing options on the command-line.
        if [[ "$BASE" == "lnet_selftest" ]] &&
                [[ -f ${LUSTRE}/../lnet/selftest/${module}${EXT} ]]; then
        # we're passing options on the command-line.
        if [[ "$BASE" == "lnet_selftest" ]] &&
                [[ -f ${LUSTRE}/../lnet/selftest/${module}${EXT} ]]; then
-               insmod ${LUSTRE}/../lnet/selftest/${module}${EXT}
+               lustre_insmod ${LUSTRE}/../lnet/selftest/${module}${EXT}
        elif [[ -f ${LUSTRE}/${module}${EXT} ]]; then
                [[ "$BASE" != "ptlrpc_gss" ]] || modprobe sunrpc
        elif [[ -f ${LUSTRE}/${module}${EXT} ]]; then
                [[ "$BASE" != "ptlrpc_gss" ]] || modprobe sunrpc
-               insmod ${LUSTRE}/${module}${EXT} "$@"
+               lustre_insmod ${LUSTRE}/${module}${EXT} "$@"
        else
                # must be testing a "make install" or "rpm" installation
                # note failed to load ptlrpc_gss is considered not fatal
        else
                # must be testing a "make install" or "rpm" installation
                # note failed to load ptlrpc_gss is considered not fatal