From: James Simmons Date: Thu, 13 Apr 2017 19:54:23 +0000 (-0400) Subject: LU-9327 test: handle nodes lacking numbers in names for hostlist_expand. X-Git-Tag: 2.9.57~50 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=60b6b9712b3a57f38371a93d64cb27f304eba004 LU-9327 test: handle nodes lacking numbers in names for hostlist_expand. Currently hostlist_expand() in test-framework assumes all node names will contain numbers to sort them by. It is possible to have nodes that instead are named alphabetical in nature (nodea, nodeb, ...). Handle this additional case. Change-Id: I014d7934a869192b3bc1908b4b0d559724d443c9 Signed-off-by: James Simmons Reviewed-on: https://review.whamcloud.com/26560 Tested-by: Jenkins Reviewed-by: Jian Yu Tested-by: Maloo Reviewed-by: Minh Diep Reviewed-by: Oleg Drokin --- diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index 401a806..24fc8cc 100755 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -2843,6 +2843,8 @@ hostlist_expand() { group=${group%%]*} for range in ${group//,/ }; do + local order + begin=${range%-*} end=${range#*-} @@ -2858,7 +2860,13 @@ hostlist_expand() { begin=$(echo $begin | sed 's/0*//') [ -z $begin ] && begin=0 - for num in $(seq -f "%0${padlen}g" $begin $end); do + if [ ! -z "${begin##[!0-9]*}" ]; then + order=$(seq -f "%0${padlen}g" $begin $end) + else + order=$(eval echo {$begin..$end}); + fi + + for num in $order; do value="${name#*,}${num}${back}" [ "$value" != "${value/\[/}" ] && { value=$(hostlist_expand "$value")