diff --git a/testsuite/expect/globals b/testsuite/expect/globals index 3189d69dd74d0a0867aef409ea6ae7681eaa5930..36c518e48d5f23913e68cd6efca3b470d87ccc9c 100755 --- a/testsuite/expect/globals +++ b/testsuite/expect/globals @@ -984,40 +984,44 @@ proc is_super_user { } { # # ################################################################ -set found(13) 1 -send_user [info exists found(13)] -send_user "\n" -# -# Use sacctmgr to create a cluster -# -set sadd_pid [spawn $sacctmgr -n -p list assoc format=lft,rgt cluster=clus1] -expect { - -re "($number)\\|($number)\\|" { - set num1 $expect_out(1,string) - set num2 $expect_out(2,string) - set first [info exists found($num1)] - set sec [info exists found($num2)] - #send_user "$first=$num1 $sec=$num2\n"; - if { $first } { - send_user "\nFAILURE: NO BUENO.found $num1 again\n" - set exit_code 1 - } elseif { $sec } { - send_user "\nFAILURE: NO BUENO.found $num2 again\n" - set exit_code 1 - } else { - set found($num1) 1 - set found($num2) 1 - } - exp_continue - } - timeout { - send_user "\nFAILURE: sacctmgr add not responding\n" - slow_kill $sadd_pid - set exit_code 1 - } - eof { - wait - } +proc check_acct_associations { options } { + global sacctmgr number + + set rc 1 + set found(13) 1 + send_user [info exists found(13)] + send_user "\n" + # + # Use sacctmgr to check associations + # + set s_pid [spawn $sacctmgr -n -p list assoc format=lft,rgt $options] + expect { + -re "($number)\\|($number)\\|" { + set num1 $expect_out(1,string) + set num2 $expect_out(2,string) + set first [info exists found($num1)] + set sec [info exists found($num2)] + #send_user "$first=$num1 $sec=$num2\n"; + if { $first } { + send_user "\nFAILURE: found lft $num1 again\n" + set rc 1 + } elseif { $sec } { + send_user "\nFAILURE: found rgt $num2 again\n" + set rc 1 + } else { + set found($num1) 1 + set found($num2) 1 + } + exp_continue + } + timeout { + send_user "\nFAILURE: sacctmgr add not responding\n" + slow_kill $s_pid + set exit_code 1 + } + eof { + wait + } + } + return $rc } - -exit;