From 1ba88c64ca24cb224edf1ca7bcfd89ec8542b051 Mon Sep 17 00:00:00 2001 From: James Simmons Date: Thu, 6 Dec 2012 11:08:29 -0500 Subject: [PATCH] LU-1229 tests: fix set module parameters from modprobe.conf 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 Signed-off-by: Alexey Lyashkov Change-Id: I08a6a562009c44e2a00ee5d489815164f638954d Reviewed-on: http://review.whamcloud.com/2342 Reviewed-by: Keith Mannthey Tested-by: Hudson Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/tests/test-framework.sh | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index a3f328b..d7a7a83 100644 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -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 - # Nothing in $MODOPTS_; 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_; 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 -- 1.8.3.1