From 60b6b9712b3a57f38371a93d64cb27f304eba004 Mon Sep 17 00:00:00 2001 From: James Simmons Date: Thu, 13 Apr 2017 15:54:23 -0400 Subject: [PATCH] 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 --- lustre/tests/test-framework.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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") -- 1.8.3.1