diff --git a/testsuite/expect/README b/testsuite/expect/README index 40f6061d7546eafe08c9cf7d7a48b33d67b65041..e995174d53aad80618ee0bd075eed128766cbd78 100644 --- a/testsuite/expect/README +++ b/testsuite/expect/README @@ -387,8 +387,8 @@ test17.4 Confirm that as sbatch job executes as the appropriate user and group. test17.5 Confirm that sbatch stdout, and stderr options work (--output and --error option respectively, including use of %j specification) -test17.6 Confirm that a job executes with the proper task count (--nprocs - and --overcommit options). +test17.6 Confirm that a job executes with the proper task count (--tasks + option). test17.7 Confirm that sbatch sets appropriate working directory (--chdir option) test17.8 Confirm that sbatch sets appropriate time limit (--time diff --git a/testsuite/expect/test17.6 b/testsuite/expect/test17.6 index 5022b13ed4ca9accca1fb4566a31c95f1bd6ddcb..2347c44438d23b5051d5702f10df3998e6fce263 100755 --- a/testsuite/expect/test17.6 +++ b/testsuite/expect/test17.6 @@ -1,8 +1,8 @@ #!/usr/bin/expect ############################################################################ # Purpose: Test of SLURM functionality -# Confirm that a job executes with the proper task count (--nprocs -# and --overcommit options). +# Confirm that a job executes with the proper task count (--tasks +# option). # # Output: "TEST: #.#" followed by "SUCCESS" if test was successful, OR # "FAILURE: ..." otherwise with an explanation of the failure, OR @@ -42,19 +42,72 @@ set tasks 0 print_header $test_id # -# Delete left-over stdin/out/err files -# Build stdin file +# Submit a slurm job that will execute 'id' on 4 tasks (or try) anway # file delete $file_in $file_out -make_bash_script $file_in " - $srun -n $task_cnt --overcommit $bin_id -" +make_bash_script $file_in "$slaunch $bin_id" +set job_id 0 +set no_run 0 +spawn $sbatch --tasks=$task_cnt --output=$file_out -t1 $file_in +expect { + -re "Submitted batch job ($number)" { + set job_id $expect_out(1,string) + exp_continue + } + -re "Failed to allocate" { + send_user "\nNo worries, error not unexpected\n" + set no_run 1 + exp_continue + } + timeout { + send_user "\nFAILURE: sbatch not responding\n" + set exit_code 1 + } + eof { + wait + } +} +if {$job_id != 0} { + spawn $scontrol show job $job_id + expect { + -re "ReqProcs=($number)" { + set tasks $expect_out(1,string) + exp_continue + } + timeout { + send_user "\nFAILURE: scontrol not responding\n" + set exit_code 1 + } + eof { + wait + } + } + if {$tasks < $task_cnt} { + send_user "\nFAILURE: sbatch --tasks not satsified\n" + set exit_code 1 + } + if {[wait_for_job $job_id "DONE"] != 0} { + send_user "\nFAILURE: waiting for job to complete\n" + set exit_code 1 + } + if {[wait_for_file $file_out] == 0} { + file delete $file_out + } +} else { + if {$no_run == 0} { + send_user "\nFAILURE: sbatch failed to create job\n" + set exit_code 1 + } +} # # Submit a slurm job that will execute 'id' on 1 node and over task_cnt tasks # +file delete $file_in $file_out +make_bash_script $file_in "$srun -n $task_cnt --overcommit $bin_id" set job_id 0 -spawn $sbatch -N1 --output=$file_out -t1 $file_in +set tasks 0 +spawn $sbatch --tasks=1 --output=$file_out -t1 $file_in expect { -re "Submitted batch job ($number)" { set job_id $expect_out(1,string) @@ -63,7 +116,6 @@ expect { timeout { send_user "\nFAILURE: sbatch not responding\n" set exit_code 1 - exp_continue } eof { wait @@ -81,7 +133,6 @@ if {[wait_for_job $job_id "DONE"] != 0} { send_user "\nFAILURE: waiting for job to complete\n" set exit_code 1 } - if {[wait_for_file $file_out] == 0} { spawn $bin_cat $file_out expect { @@ -94,12 +145,12 @@ if {[wait_for_file $file_out] == 0} { } } } - if {$task_cnt != $tasks} { send_user "\nFAILURE: Did not get proper number of tasks: " send_user "$task_cnt, $tasks\n" set exit_code 1 } + if {$exit_code == 0} { file delete $file_in $file_out send_user "\nSUCCESS\n"