From 20b2049b48e57cd565dfb0eded0c0e810075ad14 Mon Sep 17 00:00:00 2001 From: Nathan Yee <nyee32@schedmd.com> Date: Mon, 5 Nov 2012 12:38:04 -0800 Subject: [PATCH] Move change_subbp_state to globals --- testsuite/expect/globals | 74 ++++++++++++++++++++++++++++++++++++++++ testsuite/expect/test8.8 | 65 ----------------------------------- 2 files changed, 74 insertions(+), 65 deletions(-) diff --git a/testsuite/expect/globals b/testsuite/expect/globals index 5e1adae4e5e..05581215622 100755 --- a/testsuite/expect/globals +++ b/testsuite/expect/globals @@ -2338,3 +2338,77 @@ proc print_success { test_id } { send_user "\n" send_user "SUCCESS: test$test_id\n" } + +############################################################### +# +#Proc: change_subbp_state +# +#Purpose: Set sub mid plane state +# +#Returns SUCCESS if state of mid plane is changed +# +# +############################################################### + +proc change_subbp_state { node ionodes state } { + global scontrol smap + + set exit_code 0 + + set my_pid [spawn $scontrol update subbpname=$node\[$ionodes\] state=$state] + expect { + -re "slurm_update error:" { + set exit_code 1 + exp_continue + } + -re "Unable to contact" { + send_user "\nFAILURE: slurm appears to be down\n" + exp_continue + } + timeout { + send_user "\nFAILURE: scontrol not responding\n" + slow_kill $my_pid + set exit_code 1 + } + eof { + wait + } + } + + if { $exit_code } { + return $exit_code + } + + set match 0 + set my_pid [spawn $smap -Db -c -h -n $node -I $ionodes] + expect { + -nocase -re "$state" { + incr match + exp_continue + } + -re "$node" { + incr match + exp_continue + } + -re "Unable to contact" { + send_user "\nFAILURE: slurm appears to be down\n" + exp_continue + } + timeout { + send_user "\nFAILURE: smap not responding\n" + slow_kill $my_pid + set exit_code 1 + } + eof { + wait + } + } + + if {$match != 2} { + send_user "\nFAILURE: Subbp did not go into $state state. $match\n" + set exit_code 1 + } + + return $exit_code +} + diff --git a/testsuite/expect/test8.8 b/testsuite/expect/test8.8 index 963aad87e76..d45b66539e3 100755 --- a/testsuite/expect/test8.8 +++ b/testsuite/expect/test8.8 @@ -365,71 +365,6 @@ proc change_block_state { block state } { return [is_block_in_state $block $state] } -# set a block in a error state -proc change_subbp_state { node ionodes state } { - global scontrol smap - - set exit_code 0 - - set my_pid [spawn $scontrol update subbpname=$node\[$ionodes\] state=$state] - expect { - -re "slurm_update error:" { - set exit_code 1 - exp_continue - } - -re "Unable to contact" { - send_user "\nFAILURE: slurm appears to be down\n" - exp_continue - } - timeout { - send_user "\nFAILURE: scontrol not responding\n" - slow_kill $my_pid - set exit_code 1 - } - eof { - wait - } - } - - if { $exit_code } { - return $exit_code - } - - set match 0 - set my_pid [spawn $smap -Db -c -h -n $node -I $ionodes] - expect { - -nocase -re "$state" { - incr match - exp_continue - } - -re "$node" { - incr match - exp_continue - } - -re "Unable to contact" { - send_user "\nFAILURE: slurm appears to be down\n" - exp_continue - } - timeout { - send_user "\nFAILURE: smap not responding\n" - slow_kill $my_pid - set exit_code 1 - } - eof { - wait - } - } - - if {$match != 2} { - send_user "\nFAILURE: Subbp did not go into $state state. $match\n" - set exit_code 1 - } - - return $exit_code -} - - - # TEST STARTS HERE print_header $test_id -- GitLab