#!/usr/bin/env expect ############################################################################ # Purpose: Test for multiple, out of order srun --het-group options ############################################################################ # Copyright (C) 2017 SchedMD LLC. # Written by Isaac Hartung # # This file is part of Slurm, a resource management program. # For details, see . # Please also read the included file: DISCLAIMER. # # Slurm is free software; you can redistribute it and/or modify it under # the terms of the GNU General Public License as published by the Free # Software Foundation; either version 2 of the License, or (at your option) # any later version. # # Slurm is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more # details. # # You should have received a copy of the GNU General Public License along # with Slurm; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ############################################################################ source ./globals set exit_code 0 set file_in1 "test$test_id.in1" set file_in2 "test$test_id.in2" set file_in3 "test$test_id.in3" set job_id 0 set matches 0 proc end_it { exit_code } { global job_id scancel bin_rm file_in1 file_in2 file_in3 test_id if {$job_id != 0} { exec $scancel $job_id } exec $bin_rm -f $file_in1 $file_in2 $file_in3 if {$exit_code != 0} { fail "Test failed due to previous errors (\$exit_code = $exit_code)" } pass } # find out if we have enough nodes to test functionality set node_count [get_node_cnt_in_part] if { $node_count < 3 } { skip "Insufficient nodes in default partition ($node_count < 3)" } if {[test_front_end]} { skip "This test is incompatible with front-end systems" } if {[test_hetjob_step] == 0} { skip "Heterogeneous steps not currently supported" } make_bash_script $file_in1 "$srun -l --mpi=none --het-group=0,2 ./$file_in2 : --het-group=1 ./$file_in3" make_bash_script $file_in2 "$bin_echo FILE2" make_bash_script $file_in3 "$bin_echo FILE3" set timeout $max_job_delay spawn $salloc -t1 -N1 : -N1 : -N1 ./$file_in1 expect { -re "Job submit/allocate failed" { log_warn "Unable to execute test due to system configuration" end_it 0 } -re "Granted job allocation ($number)" { incr matches set job_id $expect_out(1,string) if {$job_id == 0} { set job_id $expect_out(1,string) } exp_continue } -re "($number): FILE($number)" { if {$expect_out(1,string) == 0 && $expect_out(2,string) == 2} { incr matches } elseif {$expect_out(1,string) == 1 && $expect_out(2,string) == 3} { incr matches } elseif {$expect_out(1,string) == 2 && $expect_out(2,string) == 2} { incr matches } else { log_error "Invalid output ($expect_out(1,string): FILE$expect_out(2,string))" set exit_code 1 } exp_continue } timeout { log_error "salloc not responding" end_it 1 } eof { wait } } if {$job_id == 0} { log_error "Error submitting job" end_it 1 } if {$matches != 4} { log_error "Invalid output ($matches != 4)" end_it 1 } end_it $exit_code