Whamcloud - gitweb
LU-1229 tests: fix set module parameters from modprobe.conf
authorJames Simmons <uja.ornl@gmail.com>
Thu, 6 Dec 2012 16:08:29 +0000 (11:08 -0500)
committerOleg Drokin <green@whamcloud.com>
Fri, 14 Dec 2012 03:14:19 +0000 (22:14 -0500)
Currently the test framework can't process multiple options
on separate lines for the same module from the module config
file. Once those parameters are collected they are supposed
to be stored in the MODOPT_X shell variable to be used later
to reload the modules but this was not being done. This patch
address both of these issues.

Signed-off-by: James Simmons <uja.ornl@gmail.com>
Signed-off-by: Alexey Lyashkov <alexey_lyashkov@xyratex.com>
Change-Id: I08a6a562009c44e2a00ee5d489815164f638954d
Reviewed-on: http://review.whamcloud.com/2342
Reviewed-by: Keith Mannthey <keith.mannthey@intel.com>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/test-framework.sh

index a3f328b..d7a7a83 100644 (file)
@@ -371,20 +371,24 @@ load_module() {
         optvar="MODOPTS_$(basename $module | tr a-z A-Z)"
         eval set -- \$$optvar
         if [ $# -eq 0 -a -n "$MODPROBECONF" ]; then
         optvar="MODOPTS_$(basename $module | tr a-z A-Z)"
         eval set -- \$$optvar
         if [ $# -eq 0 -a -n "$MODPROBECONF" ]; then
-            # Nothing in $MODOPTS_<MODULE>; try modprobe.conf
-            set -- $(grep -P "^options\\s+${BASE}" $MODPROBECONF)
-            # Get rid of "options $module"
-            (($# > 0)) && shift 2
-
-            # Ensure we have accept=all for lnet
-            if [ $(basename $module) = lnet ]; then
-                # OK, this is a bit wordy...
-                local arg accept_all_present=false
-                for arg in "$@"; do
-                    [ "$arg" = accept=all ] && accept_all_present=true
-                done
-                $accept_all_present || set -- "$@" accept=all
-            fi
+               # Nothing in $MODOPTS_<MODULE>; try modprobe.conf
+               local opt
+               opt=$(awk -v var="^options $BASE" '$0 ~ var \
+                       {gsub("'"options $BASE"'",""); print}' $MODPROBECONF)
+               set -- $(echo -n $opt)
+
+               # Ensure we have accept=all for lnet
+               if [ $(basename $module) = lnet ]; then
+                       # OK, this is a bit wordy...
+                       local arg accept_all_present=false
+
+                       for arg in "$@"; do
+                               [ "$arg" = accept=all ] && \
+                                       accept_all_present=true
+                       done
+                       $accept_all_present || set -- "$@" accept=all
+               fi
+               export $optvar="$*"
         fi
     fi
 
         fi
     fi