From bebf2b2ca89bbba9af3da6fbae2e97f02409bed0 Mon Sep 17 00:00:00 2001 From: grev Date: Tue, 21 Apr 2009 19:03:40 +0000 Subject: [PATCH] b=19116 i=Robert.Read convert "-" to X to create client variable name --- lustre/tests/recovery-random-scale.sh | 2 +- lustre/tests/replay-vbr.sh | 10 +++++----- lustre/tests/test-framework.sh | 18 +++++++++++------- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/lustre/tests/recovery-random-scale.sh b/lustre/tests/recovery-random-scale.sh index d624b0c..061a2b9 100644 --- a/lustre/tests/recovery-random-scale.sh +++ b/lustre/tests/recovery-random-scale.sh @@ -212,7 +212,7 @@ while [ $ELAPSED -lt $DURATION -a ! -e $END_RUN_FILE ]; do it_time_start=$(date +%s) FAIL_CLIENT=$(get_random_entry $NODES_TO_USE) - client_var=${FAIL_CLIENT}_nums + client_var=$(client_var_name $FAIL_CLIENT)_nums # store the list of failed clients # lists are comma separated diff --git a/lustre/tests/replay-vbr.sh b/lustre/tests/replay-vbr.sh index e418b9e..1ffa3bd 100644 --- a/lustre/tests/replay-vbr.sh +++ b/lustre/tests/replay-vbr.sh @@ -434,17 +434,17 @@ rmultiop_start() { local multiop_pid multiop_pid=$(do_node $client cat $pid_file) [ -n "$multiop_pid" ] || error "$client : Can not get multiop_pid from $pid_file " - eval export ${client}_multiop_pid=$multiop_pid - eval export ${client}_do_node_pid=$pid - local var=${client}_multiop_pid + eval export $(client_var_name $client)_multiop_pid=$multiop_pid + eval export $(client_var_name $client)_do_node_pid=$pid + local var=$(client_var_name $client)_multiop_pid echo client $client multiop_bg started multiop_pid=${!var} return $? } rmultiop_stop() { local client=$1 - local multiop_pid=${client}_multiop_pid - local do_node_pid=${client}_do_node_pid + local multiop_pid=$(client_var_name $client)_multiop_pid + local do_node_pid=$(client_var_name $client)_do_node_pid echo "Stopping multiop_pid=${!multiop_pid} (kill ${!multiop_pid} on $client)" do_node $client kill -USR1 ${!multiop_pid} diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index a305609..e129006 100644 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -818,18 +818,24 @@ check_progs_installed () { eval \\\$status" } +client_var_name() { + echo __$(echo $1 | tr '-' 'X') +} + start_client_load() { local client=$1 - local var=${client}_load + local load=$2 + local var=$(client_var_name $client)_load + eval export ${var}=$load do_node $client "PATH=$PATH MOUNT=$MOUNT ERRORS_OK=$ERRORS_OK \ BREAK_ON_ERROR=$BREAK_ON_ERROR \ END_RUN_FILE=$END_RUN_FILE \ LOAD_PID_FILE=$LOAD_PID_FILE \ TESTSUITELOG=$TESTSUITELOG \ - run_${!var}.sh" & + run_${load}.sh" & CLIENT_LOAD_PIDS="$CLIENT_LOAD_PIDS $!" - log "Started client load: ${!var} on $client" + log "Started client load: ${load} on $client" return 0 } @@ -841,16 +847,14 @@ start_client_loads () { for ((nodenum=0; nodenum < ${#clients[@]}; nodenum++ )); do testnum=$((nodenum % numloads)) - eval export ${clients[nodenum]}_load=${CLIENT_LOADS[testnum]} - start_client_load ${clients[nodenum]} + start_client_load ${clients[nodenum]} ${CLIENT_LOADS[testnum]} done } # only for remote client check_client_load () { local client=$1 - local var=${client}_load - + local var=$(client_var_name $client)_load local TESTLOAD=run_${!var}.sh ps auxww | grep -v grep | grep $client | grep -q "$TESTLOAD" || return 1 -- 1.8.3.1