diff --git a/testsuite/expect/test1.99 b/testsuite/expect/test1.99 index 74814200caaad24f85073fb8641f2ffab2d9fcac..85de698ad8bb401fcd9cec192b5c3723d00486b5 100755 --- a/testsuite/expect/test1.99 +++ b/testsuite/expect/test1.99 @@ -66,60 +66,14 @@ if {[expr $ports(1) - $ports(0)] < 5} { exit 0 } -# -# Get the slurm.conf path -# -proc get_conf_path { } { - - global scontrol config_path alpha exit_code - - set got_config 0 - log_user 0 - spawn $scontrol show config - expect { - -re "SLURM_CONF.*= (/.*)/($alpha).*SLURM_VERSION" { - set config_path $expect_out(1,string) - set got_config 1 - exp_continue - } - timeout { - send_user "\nFAILURE: scontrol is not responding\n" - set exit_code 1 - } - eof { - wait - } - } - log_user 1 - - if {$got_config != 1} { - send_user "\nFAILURE: did not get slurm.conf path\n" - exit 0 - } -} - -# -# Copy slurm.conf file -# -proc copy_conf { } { - global bin_cp exit_code config_path cwd - - spawn $bin_cp -v $config_path/slurm.conf $cwd/slurm.conf.orig - expect { - timeout { - send_user "\nFAILURE: slurm.conf was not copied\n" - set exit_code 1 - } - eof { - wait - } - } -} - ### Check that SrunPortRange in scontrol show config and slurm.conf match ### send_user "\n---Checking SrunPortRange in slurm.conf and scontrol show conf---\n" -get_conf_path +set config_path [get_conf_path] +if { $exit_code != 0 } { + exit $exit_code +} + set slurm_conf_range "" spawn $bin_grep -i SrunPortRange $config_path/slurm.conf expect { @@ -202,7 +156,10 @@ if {$out_of_range != 0} { # # Copy the slurm.conf file # -copy_conf +copy_conf $config_path $cwd +if { $exit_code != 0 } { + exit $exit_code +} # # Change the slurm.conf port range to a smaller number so we can exhaust ports diff --git a/testsuite/expect/test17.51 b/testsuite/expect/test17.51 index 011755918711bb2587dc98a6a2751e2bf8ed691c..10172127cdd5778dea14611a1baf4c9b75a60473 100755 --- a/testsuite/expect/test17.51 +++ b/testsuite/expect/test17.51 @@ -38,63 +38,19 @@ set tmp_job "test$test_id\_tmp_job" print_header $test_id -# -# Get the slurm.conf path -# -proc get_conf_path { } { - - global scontrol config_path alpha exit_code - - set got_config 0 - log_user 0 - spawn $scontrol show config - expect { - -re "SLURM_CONF.*= (/.*)/($alpha).*SLURM_VERSION" { - set config_path $expect_out(1,string) - set got_config 1 - exp_continue - } - timeout { - send_user "\nFAILURE: scontrol is not responding\n" - set exit_code 1 - } - eof { - wait - } - } - log_user 1 - - if {$got_config != 1} { - send_user "\nFAILURE: did not get slurm.conf path\n" - exit 0 - } -} - -# -# Copy slurm.conf file -# -proc copy_conf { } { - global bin_cp exit_code config_path cwd - - spawn $bin_cp -v $config_path/slurm.conf $cwd/slurm.conf.orig - expect { - timeout { - send_user "\nFAILURE: slurm.conf was not copied\n" - set exit_code 1 - } - eof { - wait - } - } -} - if {[is_super_user] == 0} { send_user "\nWARNING: This test can't be run except as SlurmUser\n" exit 0 } -get_conf_path -copy_conf +set config_path [get_conf_path] +if { $exit_code != 0 } { + exit $exit_code +} +copy_conf $config_path $cwd +if { $exit_code != 0 } { + exit $exit_code +} send_user "\n---Checking sbatch uses mcs-label only for some jobs (ondemand,select mode)---\n" diff --git a/testsuite/expect/test17.52 b/testsuite/expect/test17.52 index 408cff075fc53e590a572cfdd036096a5ff0f708..eb9551528a7ca5f9f49b58d437ba4dbc804ed713 100755 --- a/testsuite/expect/test17.52 +++ b/testsuite/expect/test17.52 @@ -40,63 +40,19 @@ set file_out "test${test_id}.out" print_header $test_id -# -# Get the slurm.conf path -# -proc get_conf_path { } { - - global scontrol config_path alpha exit_code - - set got_config 0 - log_user 0 - spawn $scontrol show config - expect { - -re "SLURM_CONF.*= (/.*)/($alpha).*SLURM_VERSION" { - set config_path $expect_out(1,string) - set got_config 1 - exp_continue - } - timeout { - send_user "\nFAILURE: scontrol is not responding\n" - set exit_code 1 - } - eof { - wait - } - } - log_user 1 - - if {$got_config != 1} { - send_user "\nFAILURE: did not get slurm.conf path\n" - exit 0 - } -} - -# -# Copy slurm.conf file -# -proc copy_conf { } { - global bin_cp exit_code config_path cwd - - spawn $bin_cp -v $config_path/slurm.conf $cwd/slurm.conf.orig - expect { - timeout { - send_user "\nFAILURE: slurm.conf was not copied\n" - set exit_code 1 - } - eof { - wait - } - } -} - if {[is_super_user] == 0} { send_user "\nWARNING: This test can't be run except as SlurmUser\n" exit 0 } -get_conf_path -copy_conf +set config_path [get_conf_path] +if { $exit_code != 0 } { + exit $exit_code +} +copy_conf $config_path $cwd +if { $exit_code != 0 } { + exit $exit_code +} send_user "\n---Checking sbatch uses mcs-label only for some jobs (ondemand mode)---\n" diff --git a/testsuite/expect/test17.64 b/testsuite/expect/test17.64 index 5c4ee9bcc2887a037d3e0e4cd9e48f767a99125f..441257e5c3e5fe872aa3139850dfba293aba5a1f 100755 --- a/testsuite/expect/test17.64 +++ b/testsuite/expect/test17.64 @@ -38,56 +38,6 @@ set tmp_job "test$test_id\.bash" print_header $test_id -# -# Get the slurm.conf path -# -proc get_conf_path { } { - - global scontrol config_path alpha exit_code - - set got_config 0 - log_user 0 - spawn $scontrol show config - expect { - -re "SLURM_CONF.*= (/.*)/($alpha).*SLURM_VERSION" { - set config_path $expect_out(1,string) - set got_config 1 - exp_continue - } - timeout { - send_user "\nFAILURE: scontrol is not responding\n" - set exit_code 1 - } - eof { - wait - } - } - log_user 1 - - if {$got_config != 1} { - send_user "\nFAILURE: did not get slurm.conf path\n" - exit 1 - } -} - -# -# Copy slurm.conf file -# -proc copy_conf { } { - global bin_cp exit_code config_path cwd - - spawn $bin_cp -v $config_path/slurm.conf $cwd/slurm.conf.orig - expect { - timeout { - send_user "\nFAILURE: slurm.conf was not copied\n" - set exit_code 1 - } - eof { - wait - } - } -} - if {[is_super_user] == 0} { send_user "\nWARNING: This test can't be run except as SlurmUser\n" exit 0 @@ -98,8 +48,14 @@ if { [test_account_storage] == 0 } { exit 0 } -get_conf_path -copy_conf +set config_path [get_conf_path] +if { $exit_code != 0 } { + exit $exit_code +} +copy_conf $config_path $cwd +if { $exit_code != 0 } { + exit $exit_code +} send_user "\n---Checking sbatch uses mcs-label only for some jobs (ondemand mode)---\n" diff --git a/testsuite/expect/test31.1 b/testsuite/expect/test31.1 index 07c7bca087624908ac34a5cbaded8de5bf49497b..86a4b7a2f1ec51df81747dee4556ad5921ed6d7d 100755 --- a/testsuite/expect/test31.1 +++ b/testsuite/expect/test31.1 @@ -216,27 +216,9 @@ if { [test_front_end] == 1 } { exit $exit_code } -log_user 0 -set got_config 0 -spawn $scontrol show config -expect { - -re "SLURM_CONF.*= (/.*)/($alpha).*SLURM_VERSION" { - set config_dir $expect_out(1,string) - set got_config 1 - exp_continue - } - timeout { - send_user "\nFAILURE: scontrol is not responding\n" - set exit_code 1 - } - eof { - wait - } -} -log_user 1 -if {$got_config == 0} { - send_user "\nFAILURE: Could not identify slurm.conf location\n" - exit 1 +set config_dir [get_conf_path] +if { $exit_code != 0 } { + exit $exit_code } set get_name 0 @@ -266,16 +248,9 @@ if {$get_name != 1} { # # Copy slurm.conf file # -exec $bin_rm -fr $cwd/slurm.conf.orig -spawn $bin_cp -v $config_dir/slurm.conf $cwd/slurm.conf.orig -expect { - timeout { - send_user "\nFAILURE: slurm.conf was not copied\n" - set exit_code 1 - } - eof { - wait - } +copy_conf $config_dir $cwd +if { $exit_code != 0 } { + exit $exit_code } # diff --git a/testsuite/expect/test31.2 b/testsuite/expect/test31.2 index c96f23e96a72e2eec88226af0bed0758f45a4b77..f214acc8d4a89ea7497c8880b7b0d0cc94872d9f 100755 --- a/testsuite/expect/test31.2 +++ b/testsuite/expect/test31.2 @@ -82,41 +82,18 @@ sleep 20 " # Get the location of the slurm.conf file -set got_config 0 -spawn $scontrol show config -expect { - -re "SLURM_CONF.*= (/.*)/($alpha).*SLURM_VERSION" { - set config_dir $expect_out(1,string) - set got_config 1 - exp_continue - } - timeout { - send_user "\nFAILURE: scontrol is not responding\n" - set exit_code 1 - } - eof { - wait - } -} -if {$got_config == 0} { - send_user "\nFAILURE: Could not identify slurm.conf location\n" - exit 1 +set config_dir [get_conf_path] +if { $exit_code != 0 } { + exit $exit_code } # # Copy slurm.conf file # set cwd [$bin_pwd] -exec $bin_rm -fr $cwd/slurm.conf.orig -spawn $bin_cp -v $config_dir/slurm.conf $cwd/slurm.conf.orig -expect { - timeout { - send_user "\nFAILURE: slurm.conf was not copied\n" - exit 1 - } - eof { - wait - } +copy_conf $config_dir $cwd +if { $exit_code != 0 } { + exit $exit_code } exec $bin_sed -i {s/^\(Prolog=\)/#\1/gI} $config_dir/slurm.conf