From 1ce0d17b2d78f2de925aa08da67f0de94cf815e9 Mon Sep 17 00:00:00 2001 From: Moe Jette <jette1@llnl.gov> Date: Tue, 1 Aug 2006 18:30:21 +0000 Subject: [PATCH] Add more sbatch tests. --- testsuite/expect/README | 6 ++ testsuite/expect/test1.12 | 18 ++-- testsuite/expect/test1.14 | 9 +- testsuite/expect/test1.15 | 2 +- testsuite/expect/test17.10 | 145 +++++++++++++++++++++++++++++++ testsuite/expect/test17.11 | 169 +++++++++++++++++++++++++++++++++++++ testsuite/expect/test17.12 | 84 ++++++++++++++++++ 7 files changed, 418 insertions(+), 15 deletions(-) create mode 100755 testsuite/expect/test17.10 create mode 100755 testsuite/expect/test17.11 create mode 100755 testsuite/expect/test17.12 diff --git a/testsuite/expect/README b/testsuite/expect/README index 8dda6650b03..bf7423b7fae 100644 --- a/testsuite/expect/README +++ b/testsuite/expect/README @@ -359,6 +359,12 @@ test17.7 Confirm that sbatch sets appropriate working directory (--chdir test17.8 Confirm that sbatch sets appropriate time limit (--time option) test17.9 Confirm that sbatch sets appropriate job name (--job-name option) +test17.10 Test of processors, memory, and temporary disk space + constraints options (--mincpus, --mem, and --tmp options). + Also test that priority zero job is not started (--hold + option). +test17.11 Test of shared and contiguous options (--shared and --contiguous). + Also uses --hold option. test18.# Testing of slaunch options. diff --git a/testsuite/expect/test1.12 b/testsuite/expect/test1.12 index 2d8b8dadce9..c8fc11eb163 100755 --- a/testsuite/expect/test1.12 +++ b/testsuite/expect/test1.12 @@ -9,11 +9,8 @@ # Output: "TEST: #.#" followed by "SUCCESS" if test was successful, OR # "FAILURE: ..." otherwise with an explanation of the failure, OR # anything else indicates a failure mode that must be investigated. -# -# Note: This script generates and then deletes files in the working directory -# named test1.12.input, test1.12.output, and test1.12.error ############################################################################ -# Copyright (C) 2002 The Regents of the University of California. +# Copyright (C) 2002-2006 The Regents of the University of California. # Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). # Written by Morris Jette <jette1@llnl.gov> # UCRL-CODE-217948. @@ -42,10 +39,10 @@ set exit_code 0 set file_in "test$test_id.input" set job_id 0 -set cpu_cnt 1 -set mem_size 13 -set tmp_size 2 -set matches 0 +set cpu_cnt 1 +set mem_size 13 +set tmp_size 2 +set matches 0 print_header $test_id @@ -55,7 +52,7 @@ print_header $test_id # exec $bin_rm -f $file_in make_bash_script $file_in " - $srun $bin_sleep 10 + $bin_sleep 10 " # @@ -82,7 +79,6 @@ if {$job_id == 0} { send_user "\nFAILURE: batch submit failure\n" exit 1 } -exec $bin_rm -f $file_in # # Confirm constraints are registered and wait for job completion @@ -128,7 +124,6 @@ expect { } timeout { send_user "\nFAILURE: scontrol not responding\n" - cancel_job $job_id set exit_code 1 } eof { @@ -142,6 +137,7 @@ if {$matches != 5} { set exit_code 1 } if {$exit_code == 0} { + exec $bin_rm -f $file_in send_user "\nSUCCESS\n" } exit $exit_code diff --git a/testsuite/expect/test1.14 b/testsuite/expect/test1.14 index 1f279b0ff96..f6b3e6800aa 100755 --- a/testsuite/expect/test1.14 +++ b/testsuite/expect/test1.14 @@ -8,7 +8,7 @@ # "FAILURE: ..." otherwise with an explanation of the failure, OR # anything else indicates a failure mode that must be investigated. ############################################################################ -# Copyright (C) 2002 The Regents of the University of California. +# Copyright (C) 2002-2006 The Regents of the University of California. # Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). # Written by Morris Jette <jette1@llnl.gov> # UCRL-CODE-217948. @@ -55,6 +55,7 @@ expect { exp_continue } eof { + wait } } @@ -80,10 +81,10 @@ if {$job_id != 0} { } timeout { send_user "\nFAILURE: scontrol not responding\n" - cancel_job $job_id set exit_code 1 } eof { + wait } } cancel_job $job_id @@ -95,6 +96,7 @@ if {$job_id != 0} { # # Spawn a srun batch job with contiguous option only # +set job_id 0 spawn $srun --contiguous --hold --batch -t1 $bin_pwd expect { -re "jobid ($number) submitted" { @@ -106,6 +108,7 @@ expect { exit 1 } eof { + wait } } @@ -131,10 +134,10 @@ if {$job_id != 0} { } timeout { send_user "\nFAILURE: scontrol not responding\n" - cancel_job $job_id set exit_code 1 } eof { + wait } } cancel_job $job_id diff --git a/testsuite/expect/test1.15 b/testsuite/expect/test1.15 index 99328f12c9c..89fae393a4f 100755 --- a/testsuite/expect/test1.15 +++ b/testsuite/expect/test1.15 @@ -47,7 +47,7 @@ print_header $test_id # exec $bin_rm -f $file_in make_bash_script $file_in " - if ((\$SLURM_PROCID== 1)) + if ((\$SLURM_PROCID == 1)) then exit fi $bin_sleep 300 diff --git a/testsuite/expect/test17.10 b/testsuite/expect/test17.10 new file mode 100755 index 00000000000..b0cc9a75ced --- /dev/null +++ b/testsuite/expect/test17.10 @@ -0,0 +1,145 @@ +#!/usr/bin/expect +############################################################################ +# Purpose: Test of SLURM functionality +# Test of processors, memory, and temporary disk space +# constraints options (--mincpus, --mem, and --tmp options). +# Also test that priority zero job is not started (--hold +# option). +# +# Output: "TEST: #.#" followed by "SUCCESS" if test was successful, OR +# "FAILURE: ..." otherwise with an explanation of the failure, OR +# anything else indicates a failure mode that must be investigated. +############################################################################ +# Copyright (C) 2002-2006 The Regents of the University of California. +# Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). +# Written by Morris Jette <jette1@llnl.gov> +# UCRL-CODE-217948. +# +# This file is part of SLURM, a resource management program. +# For details, see <http://www.llnl.gov/linux/slurm/>. +# +# 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., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +############################################################################ +source ./globals + +set test_id "17.10" +set exit_code 0 +set file_in "test$test_id.input" +set job_id 0 + +set cpu_cnt 1 +set mem_size 13 +set tmp_size 2 +set matches 0 + +print_header $test_id + +# DISABLE FOR NOW +send_user "\nFAILURE: sbatch does not yet support --output option\n" +exit 0 + +# +# Delete left-over input script +# Build input script file +# +exec $bin_rm -f $file_in +make_bash_script $file_in " + $bin_sleep 10 +" + +# +# Spawn a sbatch job with constraints and stdout/err +# +spawn $sbatch --output=none --error=none --mincpus=$cpu_cnt --mem=$mem_size --tmp=$tmp_size --hold -t1 $file_in +expect { + -re "Submitted batch job ($number)" { + set job_id $expect_out(1,string) + exp_continue + } + timeout { + send_user "\nFAILURE: sbatch not responding\n" + set exit_code 1 + exp_continue + } + eof { + wait + } +} +if {$job_id == 0} { + send_user "\nFAILURE: batch submit failure\n" + exit 1 +} + +# +# Confirm constraints are registered and wait for job completion +# +spawn $scontrol show job $job_id +expect { + -re "Priority=($number)" { + set read_prio $expect_out(1,string) + if {$read_prio == 0} { + incr matches + send_user "match of Priority\n" + } + exp_continue + } + -re "JobState=PENDING" { + incr matches + send_user "match of JobState\n" + exp_continue + } + -re "MinProcs=($number)" { + set read_proc $expect_out(1,string) + if {$read_proc == $cpu_cnt} { + incr matches + send_user "match of MinProcs\n" + } + exp_continue + } + -re "MinMemory=($number)" { + set read_mem $expect_out(1,string) + if {$read_mem == $mem_size} { + incr matches + send_user "match of MinMemory\n" + } + exp_continue + } + -re "MinTmpDisk=($number)" { + set read_disk $expect_out(1,string) + if {$read_disk == $tmp_size} { + incr matches + send_user "match of MinTmpDisk\n" + } + exp_continue + } + timeout { + send_user "\nFAILURE: scontrol not responding\n" + set exit_code 1 + } + eof { + wait + } +} +cancel_job $job_id + +if {$matches != 5} { + send_user "\nFAILURE: Did not get proper constraints\n" + set exit_code 1 +} +if {$exit_code == 0} { + exec $bin_rm -f $file_in + send_user "\nSUCCESS\n" +} +exit $exit_code diff --git a/testsuite/expect/test17.11 b/testsuite/expect/test17.11 new file mode 100755 index 00000000000..7a04fb96733 --- /dev/null +++ b/testsuite/expect/test17.11 @@ -0,0 +1,169 @@ +#!/usr/bin/expect +############################################################################ +# Purpose: Test of SLURM functionality +# Test of shared and contiguous options (--shared and --contiguous). +# Also uses --hold option. +# +# Output: "TEST: #.#" followed by "SUCCESS" if test was successful, OR +# "FAILURE: ..." otherwise with an explanation of the failure, OR +# anything else indicates a failure mode that must be investigated. +############################################################################ +# Copyright (C) 2002-2006 The Regents of the University of California. +# Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). +# Written by Morris Jette <jette1@llnl.gov> +# UCRL-CODE-217948. +# +# This file is part of SLURM, a resource management program. +# For details, see <http://www.llnl.gov/linux/slurm/>. +# +# 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., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +############################################################################ +source ./globals + +set test_id "17.11" +set exit_code 0 +set file_in "test$test_id.input" +set job_id 0 +set matches 0 + +print_header $test_id + +# DISABLE FOR NOW +send_user "\nFAILURE: sbatch does not yet support --output option\n" +exit 0 + +# +# Delete left-over input script +# Build input script file +# +exec $bin_rm -f $file_in +make_bash_script $file_in " + $bin_sleep 10 +" + +# +# Spawn a sbatch job with shared option only +# +spawn $sbatch --share --hold -t1 $file_in +expect { + -re "Submitted batch job ($number)" { + set job_id $expect_out(1,string) + exp_continue + } + timeout { + send_user "\nFAILURE: sbatch not responding\n" + set exit_code 1 + exp_continue + } + eof { + wait + } +} + +# +# Confirm shared and contiguous flag values +# +if {$job_id != 0} { + spawn $scontrol show job $job_id + expect { + -re "Shared=($number)" { + set shared_val $expect_out(1,string) + if {$shared_val == 1} { + incr matches + } + exp_continue + } + -re "Contiguous=($number)" { + set cont_val $expect_out(1,string) + if {$cont_val == 0} { + incr matches + } + exp_continue + } + timeout { + send_user "\nFAILURE: scontrol not responding\n" + set exit_code 1 + } + eof { + wait + } + } + cancel_job $job_id + set job_id 0 +} else { + set exit_code 1 +} + +# +# Spawn a sbatch job with contiguous option only +# +set job_id 0 +spawn $sbatch --contiguous --hold -t1 $file_in +expect { + -re "Submitted batch job ($number)" { + set job_id $expect_out(1,string) + exp_continue + } + timeout { + send_user "\nFAILURE: sbatch not responding\n" + exit 1 + } + eof { + wait + } +} + +# +# Confirm shared and contiguous flag values +# +if {$job_id != 0} { + spawn $scontrol show job $job_id + expect { + -re "Shared=($number)" { + set shared_val $expect_out(1,string) + if {$shared_val == 0} { + incr matches + } + exp_continue + } + -re "Contiguous=($number)" { + set cont_val $expect_out(1,string) + if {$cont_val == 1} { + incr matches + } + exp_continue + } + timeout { + send_user "\nFAILURE: scontrol not responding\n" + set exit_code 1 + } + eof { + wait + } + } + cancel_job $job_id +} else { + set exit_code 1 +} + +if {$matches != 4} { + send_user "\nFAILURE: Did not properly set shared and contiguous flags\n" + set exit_code 1 +} +if {$exit_code == 0} { + exec $bin_rm -f $file_in + send_user "\nSUCCESS\n" +} +exit $exit_code diff --git a/testsuite/expect/test17.12 b/testsuite/expect/test17.12 new file mode 100755 index 00000000000..149ada0bad9 --- /dev/null +++ b/testsuite/expect/test17.12 @@ -0,0 +1,84 @@ +#!/usr/bin/expect +############################################################################ +# Purpose: Test of SLURM functionality +# Verify node configuration specification (--constraint option). +# +# Output: "TEST: #.#" followed by "SUCCESS" if test was successful, OR +# "WARNING: ..." with an explanation of why the test can't be made, OR +# "FAILURE: ..." otherwise with an explanation of the failure, OR +# anything else indicates a failure mode that must be investigated. +############################################################################ +# Copyright (C) 2002-2006 The Regents of the University of California. +# Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). +# Written by Morris Jette <jette1@llnl.gov> +# UCRL-CODE-217948. +# +# This file is part of SLURM, a resource management program. +# For details, see <http://www.llnl.gov/linux/slurm/>. +# +# 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., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +############################################################################ +source ./globals + +set test_id "17.12" +set exit_code 0 +set file_in "test$test_id.input" +print_header $test_id + +# +# Delete left-over input script +# Build input script file +# +exec $bin_rm -f $file_in +make_bash_script $file_in " + $bin_sleep 10 +" + +# +# Submit a job with invalid constraint requirement +# +set err_msg 0 +set timeout $max_job_delay +spawn $sbatch -N1 --constraint=invalid,constraint -t1 $file_in +expect { + -re "configuration is not available" { + send_user "This error is expected, no worries\n" + set err_msg 1 + exp_continue + } + -re "Submitted batch job ($number)" { + send_user "\nFAILURE: sbatch job submitted with invalid constraint\n" + set exit_code 1 + exp_continue + } + timeout { + send_user "\nFAILURE: sbatch not responding\n" + set exit_code 1 + exp_continue + } + eof { + wait + } +} +if {$err_msg != 1} { + send_user "\nFAILURE: job failed to report required error\n" + set exit_code 1 +} + +if {$exit_code == 0} { + exec $bin_rm -f $file_in + send_user "\nSUCCESS\n" +} +exit $exit_code -- GitLab