Whamcloud - gitweb
LU-9327 test: handle nodes lacking numbers in names for hostlist_expand. 60/26560/3
authorJames Simmons <uja.ornl@yahoo.com>
Thu, 13 Apr 2017 19:54:23 +0000 (15:54 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 26 Apr 2017 03:40:03 +0000 (03:40 +0000)
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 <uja.ornl@yahoo.com>
Reviewed-on: https://review.whamcloud.com/26560
Tested-by: Jenkins
Reviewed-by: Jian Yu <jian.yu@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Minh Diep <minh.diep@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/tests/test-framework.sh

index 401a806..24fc8cc 100755 (executable)
@@ -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")