diff --git a/testsuite/expect/globals b/testsuite/expect/globals index 890821a7108c8db9b2fad3bab6b06f8c10f203c3..d229ddb0d97631bd70f140d62accfd5410ffe2ad 100755 --- a/testsuite/expect/globals +++ b/testsuite/expect/globals @@ -2414,13 +2414,19 @@ proc make_bash_script { script_name script_contents } { # # Purpose: Given a hostname, return it's numeric suffix # -# Returns: numerical suffix for input 'hostname' +# Returns: numerical suffix for input 'hostname' or -1 if not a number # # Input: hostname -- hostname for which to return suffix # ################################################################ proc get_suffix { hostname } { set host_len [string length $hostname] + set host_inx [expr $host_len-1] + set host_char [string index $hostname $host_inx] + if {[string compare $host_char "0"] < 0 || [string compare $host_char "9"] > 0} { + return -1 + } + for {set host_inx [expr $host_len-1]} {$host_inx >= 0} {incr host_inx -1} { set host_char [string index $hostname $host_inx] if {[string compare $host_char "0"] < 0} { break } diff --git a/testsuite/expect/test1.83 b/testsuite/expect/test1.83 index 5cbd451bd4a030c7a449788356c611dceaaba967..9274038636caf3f11913b4e4480cbb98acf3f617 100755 --- a/testsuite/expect/test1.83 +++ b/testsuite/expect/test1.83 @@ -143,6 +143,11 @@ set host_0_num [get_suffix $host_0_name] set host_1_num [get_suffix $host_1_name] set host_2_num [get_suffix $host_2_name] +if {$host_0_num == -1 || $host_1_num == -1 || $host_2_num == -1} { + send_user "\nWARNING: node names lack numeric suffix\n" + exit $exit_code +} + if {$host_1_num != [expr $host_0_num + 1]} { send_user "\nFAILURE: node sequence number not contiguous\n" set exit_code 1