| #!/usr/bin/env expect |
| ############################################################################ |
| # Purpose: Test of Slurm functionality |
| # qsub command tests for Grid Engine options |
| ############################################################################ |
| # Copyright (C) SchedMD LLC. |
| # |
| # This file is part of Slurm, a resource management program. |
| # For details, see <https://slurm.schedmd.com/>. |
| # 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 file_err "$test_dir/error" |
| set file_in "$test_dir/input" |
| set file_out "$test_dir/output" |
| |
| if {[file executable $qsub] == 0} { |
| skip "$qsub not found" |
| } |
| |
| set exe "hostname" |
| set qsub_default "--sbatchline $exe" |
| |
| # test -b option (sbatch --wrap) |
| set output [run_command_output -fail "$qsub -b y $qsub_default"] |
| subtest {[regexp -all "\\-\\-wrap=\\\"$exe\\\"" $output] == 1} "Verify qsub -b option was set up correctly" |
| |
| # test -pe option (sbatch -c|--cpus-per-task) |
| set param 7 |
| set output [run_command_output -fail "$qsub -pe shm $param $qsub_default"] |
| subtest {[regexp -all "\\-\\-cpus\\-per\\-task=$param" $output] == 1} "Verify qsub -pe option was set up correctly" |
| |
| # test -P option (sbatch --wckey) |
| set param "test_wckey" |
| set output [run_command_output -fail "$qsub -P $param $qsub_default"] |
| subtest {[regexp -all "\\-\\-wckey=$param" $output] == 1} "Verify qsub -P option was set up correctly" |
| |
| # test -r option (sbatch --requeue) |
| set output [run_command_output -fail "$qsub -r y $qsub_default"] |
| subtest {[regexp -all "\\-\\-requeue" $output] == 1} "Verify qsub -r option was set up correctly" |
| |
| # test -wd option (sbatch -D) |
| set param "/new/dir" |
| set output [run_command_output -fail "$qsub -wd $param $qsub_default"] |
| subtest {[regexp -all "\\-D$param" $output] == 1} "Verify qsub -D option was set up correctly" |
| |
| # test -l h_rt option (sbatch -t) |
| set param "300" |
| set output [run_command_output -fail "$qsub -l h_rt=$param $qsub_default"] |
| set param [expr $param / 60] |
| subtest {[regexp -all "\\-t$param" $output] == 1} "Verify qsub -l h_rt option was set up correctly" |
| |
| # test -l h_rt option (sbatch -t) |
| set param "00:05:00" |
| set output [run_command_output -fail "$qsub -l h_rt=$param $qsub_default"] |
| subtest {[regexp -all "\\-t5" $output] == 1} "Verify qsub -l h_rt option was set up correctly" |
| |
| # test -l h_vmem option (sbatch --mem) |
| set param "3000" |
| set output [run_command_output -fail "$qsub -l h_vmem=$param $qsub_default"] |
| subtest {[regexp -all "\\-\\-mem=$param" $output] == 1} "Verify qsub -l h_vmem option was set up correctly" |