#!/usr/bin/env expect ############################################################################ # Purpose: Test of Slurm functionality # Validate that sbatch, srun, salloc return partition error message. ############################################################################ # Copyright (C) 2015 SchedMD LLC # Written by Nathan Yee # # 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 test_part [default_partition] set part_inv "$test_part\g" set file_in "test$test_id\.sc" set exit_code 0 make_bash_script $file_in "sleep 1" proc test_sbatch { part } { global srun salloc sbatch exit_code file_in part_inv log_info "=======Testing Values: $part=======" log_info "====Testing sbatch====" set match 0 spawn $sbatch -t1 -p$part -o/dev/null $file_in expect { -re "invalid partition specified: $part_inv" { set match 1 exp_continue } timeout { log_error "sbatch is not responding" set exit_code 1 } eof { wait } } if {$match == 0} { log_error "Error message was not correct" set exit_code 1 } log_info "====Testing srun====" set match 0 spawn $srun -t1 -p$part -o/dev/null $file_in expect { -re "invalid partition specified: $part_inv" { set match 1 exp_continue } timeout { log_error "sbatch is not responding" set exit_code 1 } eof { wait } } if {$match == 0} { log_error "Error message was not correct" set exit_code 1 } log_info "====Testing salloc====" set match 0 spawn $salloc -t1 -p$part $file_in expect { -re "invalid partition specified: $part_inv" { set match 1 exp_continue } timeout { log_error "sbatch is not responding" set exit_code 1 } eof { wait } } if {$match == 0} { log_error "Error message was not correct" set exit_code 1 } } test_sbatch $test_part\g test_sbatch "$test_part\,$test_part\g" if {$exit_code == 0} { exec $bin_rm -f $file_in } else { fail "Test failed due to previous errors" }