diff --git a/testsuite/expect/Makefile.am b/testsuite/expect/Makefile.am index 6e47cec3512e39280a1ff222dbbdbd97a62efcc4..13841ce6c7512f85e51c01de76a63e84c5fe774a 100644 --- a/testsuite/expect/Makefile.am +++ b/testsuite/expect/Makefile.am @@ -385,6 +385,7 @@ EXTRA_DIST = \ test21.27 \ test21.28 \ test21.29 \ + test21.30 \ test22.1 \ test22.2 \ test23.1 \ diff --git a/testsuite/expect/Makefile.in b/testsuite/expect/Makefile.in index e88edf2f35916c19489d6014b2a42164bd834429..61643008656d082fd5553ed2b3d7cfa27c083d4e 100644 --- a/testsuite/expect/Makefile.in +++ b/testsuite/expect/Makefile.in @@ -697,6 +697,7 @@ EXTRA_DIST = \ test21.27 \ test21.28 \ test21.29 \ + test21.30 \ test22.1 \ test22.2 \ test23.1 \ diff --git a/testsuite/expect/README b/testsuite/expect/README index ad8ba4ea088c2f1786e3ed7499cdd1ea90224730..5874ac26507e1a41c057616facf400517e6b34cd 100644 --- a/testsuite/expect/README +++ b/testsuite/expect/README @@ -579,6 +579,7 @@ test21.26 sacctmgr +=, -= modify QoS test test21.27 sacctmgr problems test test21.28 sacctmgr abort delete test21.29 sacctmgr clear (modify) QoS values +test21.30 sacctmgr test if the QoS values are enforced test22.# Testing of sreport commands and options. diff --git a/testsuite/expect/inc21.30.1 b/testsuite/expect/inc21.30.1 new file mode 100644 index 0000000000000000000000000000000000000000..640d38ef27cff4a4148cc3612c4f3a1a8759e29b --- /dev/null +++ b/testsuite/expect/inc21.30.1 @@ -0,0 +1,81 @@ +############################################################################ +# Purpose: Test of SLURM functionality +# to be called from test21.30 +# Tests if the group nodes limit is enforced +# +# +############################################################################ +# Copyright (C) 2012 SchedMD LLC +# Written by Nathan Yee <nyee32@schedmd.com> +# +# This file is part of SLURM, a resource management program. +# For details, see <http://www.schedmd.com/slurmdocs/>. +# 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. +############################################################################ + +proc inc21_30_1 {} { + +#test GrpNode limit + + global srun salloc acct bin_sleep jobmatch job_id1 job_id2 number + + set jobmatch 0 + spawn $salloc -N1 --account=$acct $srun $bin_sleep 10 + expect { + -re "Granted job allocation ($number)" { + set job_id1 $expect_out(1,string) + send_user "\njob $job_id1 has been submitted\n" + incr jobmatch + } + timeout { + send_user "\nFAILURE: salloc is not reponding\n" + exit 1 + } + eof { + wait + } + } + + spawn $salloc -N2 --account=$acct $srun $bin_sleep 10 + expect { + -re "job ($number)" { + set job_id2 $expect_out(1,string) + send_user "\nJob $job_id2 is waiting for resources. This is expected.\n" + incr jobmatch + } + timeout { + send_user "\nFAILURE: salloc is not reponding\n" + exit 1 + } + eof { + wait + } + } + + if {$jobmatch==0} { + send_user "\nFAILURE: jobs were not submitted\n" + exit 1 + } + + # checks the state of the job + check_state $job_id2 + + #cancels remaining jobs + cancel_job $job_id1 + cancel_job $job_id2 + +} diff --git a/testsuite/expect/inc21.30.2 b/testsuite/expect/inc21.30.2 new file mode 100644 index 0000000000000000000000000000000000000000..33eabc710a363d66e52d68b23fbb5197a75b80ee --- /dev/null +++ b/testsuite/expect/inc21.30.2 @@ -0,0 +1,80 @@ +# Purpose: Test of SLURM functionality +# to be called from test21.30 +# Tests if the GrpCpus limit is enforced +# +# +############################################################################ +# Copyright (C) 2012 SchedMD LLC +# Written by Nathan Yee <nyee32@schedmd.com> +# +# This file is part of SLURM, a resource management program. +# For details, see <http://www.schedmd.com/slurmdocs/>. +# 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. +############################################################################ + +proc inc21_30_2 {} { + +#test GrpCpus + + global srun salloc acct bin_sleep jobmatch job_id1 job_id2 number exit_code + + set jobmatch 0 + spawn $salloc --account=$acct -n6 $srun $bin_sleep 5 + expect { + -re "Granted job allocation ($number)" { + set job_id1 $expect_out(1,string) + send_user "\njob $job_id1 has been submitted\n" + incr jobmatch + } + timeout { + send_user "\nFAILURE: salloc is not reponding\n" + exit 1 + } + eof { + wait + } + } + + spawn $salloc --account=$acct -n6 $srun $bin_sleep 5 + expect { + -re "job ($number)" { + set job_id2 $expect_out(1,string) + send_user "\njob $job_id2 is waiting for resources. This is expected\n" + incr jobmatch + } + timeout { + send_user "\nFAILURE: salloc is not reponding\n" + exit 1 + } + eof { + wait + } + } + + if {$jobmatch==0} { + send_user "\nFAILURE: jobs were not submitted\n" + set exit 1 + } + + # checks the state of the job + check_state $job_id2 + + # cancels remaining jobs + cancel_job $job_id1 + cancel_job $job_id2 + +} diff --git a/testsuite/expect/inc21.30.3 b/testsuite/expect/inc21.30.3 new file mode 100644 index 0000000000000000000000000000000000000000..83422b5b21c16dd72a06bb577b67838d083d0790 --- /dev/null +++ b/testsuite/expect/inc21.30.3 @@ -0,0 +1,120 @@ +############################################################################ +# Purpose: Test of SLURM functionality +# to be called from test21.30 +# Tests if the GrpJob limit is enforced +# +# +############################################################################ +# Copyright (C) 2012 SchedMD LLC +# Written by Nathan Yee <nyee32@schedmd.com> +# +# This file is part of SLURM, a resource management program. +# For details, see <http://www.schedmd.com/slurmdocs/>. +# 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. +############################################################################ + +proc inc21_30_3 {} { + +# test GrpJob limits + + global salloc srun acct bin_sleep jobmatch job_id1 job_id2 job_id3 number exit_code + + set jobmatch 0 + spawn $salloc --account=$acct -n1 $srun $bin_sleep 100 + expect { + -re "Granted job allocation ($number)" { + set job_id1 $expect_out(1,string) + send_user "\njob $job_id1 was submitted\n" + incr jobmatch + } + timeout { + send_user "\nFAILURE: salloc is not responding\n" + exit 1 + } + eof { + wait + } + } + + spawn $salloc --account=$acct -n1 $srun $bin_sleep 100 + expect { + -re "Granted job allocation ($number)" { + set job_id2 $expect_out(1,string) + send_user "\njob $job_id2 was submitted\n" + incr jobmatch + } + timeout { + send_user "\nFAILURE: salloc is not responding\n" + exit 1 + + } + eof { + wait + } + } + + spawn $salloc --account=$acct -n1 $srun $bin_sleep 100 + expect { + -re "job ($number)" { + set job_id3 $expect_out(1,string) + send_user "\nJob $job_id3 is waiting for resources. This is expected\n" + incr jobmatch + } + timeout { + send_user "\nFAILURE: salloc is not responding\n" + exit 1 + } + eof { + wait + } + } + + if {$jobmatch==0} { + send_user "\nFAILURE: jobs were not submitted\n" + exit 1 + } + + #checks the job state + check_state $job_id3 + + # cancels the remaining jobs + cancel_job $job_id1 + cancel_job $job_id2 + cancel_job $job_id3 + +} + + + + + + + + + + + + + + + + + + + + + diff --git a/testsuite/expect/inc21.30.4 b/testsuite/expect/inc21.30.4 new file mode 100644 index 0000000000000000000000000000000000000000..936bdc992a0aef1ac76c3880861170c416a5d7ec --- /dev/null +++ b/testsuite/expect/inc21.30.4 @@ -0,0 +1,100 @@ +############################################################################ +# Purpose: Test of SLURM functionality +# to be called from test21.30 +# Tests if the GrpSubmits limit is enforced +# +# +############################################################################ +# Copyright (C) 2012 SchedMD LLC +# Written by Nathan Yee <nyee32@schedmd.com> +# +# This file is part of SLURM, a resource management program. +# For details, see <http://www.schedmd.com/slurmdocs/>. +# 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. +############################################################################ + +proc inc21_30_4 {} { + +# test GrpSubmit + + global salloc srun acct bin_sleep jobmatch job_id1 job_id2 job_id3 number exit_code + + set jobmatch 0 + spawn $salloc --account=$acct -n1 $srun $bin_sleep 100 + expect { + -re "Granted job allocation ($number)" { + set job_id1 $expect_out(1,string) + send_user "\njob $job_id1 was submitted\n" + incr jobmatch + } + timeout { + send_user "\nFAILURE: salloc is not responding\n" + exit 1 + } + eof { + wait + } + } + + spawn $salloc --account=$acct -n1 $srun $bin_sleep 100 + expect { + -re "Granted job allocation ($number)" { + set job_id2 $expect_out(1,string) + send_user "\njob $job_id2 was submitted\n" + incr jobmatch + } + timeout { + send_user "\nFAILURE: salloc is not responding\n" + exit 1 + } + eof { + wait + } + } + + spawn $salloc --account=$acct -n1 $srun $bin_sleep 100 + expect { + -re "error" { + set job_id3 $expect_out(1,string) + send_user "\nThis error is expected do not worry\n" + incr jobmatch + } + -re "Granted job allocation" { + send_user "\nThis should have failed but did not\n" + exit 1 + } + timeout { + send_user "\nFAILURE: salloc is not responding\n" + exit 1 + } + eof { + wait + } + } + + if {$jobmatch==0} { + send_user "\nFAILURE: jobs were not submitted\n" + exit 1 + } + + # cancels the remaining jobs + cancel_job $job_id1 + cancel_job $job_id2 + cancel_job $job_id3 + +} + diff --git a/testsuite/expect/inc21.30.5 b/testsuite/expect/inc21.30.5 new file mode 100644 index 0000000000000000000000000000000000000000..dc3b94fd65839c7f06330e1e588e330d0dada998 --- /dev/null +++ b/testsuite/expect/inc21.30.5 @@ -0,0 +1,57 @@ +############################################################################ +# Purpose: Test of SLURM functionality +# to be called from test21.30 +# Tests if the MaxCpu limit is enforced +# +# +############################################################################ +# Copyright (C) 2012 SchedMD LLC +# Written by Nathan Yee <nyee32@schedmd.com> +# +# This file is part of SLURM, a resource management program. +# For details, see <http://www.schedmd.com/slurmdocs/>. +# 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. +############################################################################ + +proc inc21_30_5 {} { + +#test MaxCpus limits + + global salloc acct number srun job_id1 bin_sleep + + spawn $salloc --account=$acct -n11 $srun $bin_sleep 2 + expect { + -re "job ($number)" { + set job_id1 $expect_out(1,string) + send_user "\nThis is expected do not worry\n" + } + -re "Granted job allocation ($number)" { + send_user "\nFAILURE: This should have failed but did not\n" + exit 1 + } + timeout { + send_user "\nFAILURE: salloc not responding\n" + exit 1 + } + eof { + wait + } + } + + # cancels remaining jobs + cancel_job $job_id1 +} diff --git a/testsuite/expect/inc21.30.6 b/testsuite/expect/inc21.30.6 new file mode 100644 index 0000000000000000000000000000000000000000..70e3d897a52765438b5c1b7f427dfd88b836eb16 --- /dev/null +++ b/testsuite/expect/inc21.30.6 @@ -0,0 +1,57 @@ +############################################################################ +# Purpose: Test of SLURM functionality +# to be called from test21.30 +# Tests if the MaxNodes limit is enforced +# +# +############################################################################ +# Copyright (C) 2012 SchedMD LLC +# Written by Nathan Yee <nyee32@schedmd.com> +# +# This file is part of SLURM, a resource management program. +# For details, see <http://www.schedmd.com/slurmdocs/>. +# 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. +############################################################################ + +proc inc21_30_6 {} { + +#test MaxNode limit + + global salloc acct number srun job_id1 bin_sleep + + spawn $salloc --account=$acct -N11 $srun $bin_sleep 2 + expect { + -re "job ($number)" { + set job_id1 $expect_out(1,string) + send_user "\nThis is expected do not worry\n" + } + -re "Granted job allocation ($number)" { + send_user "\nFAILURE: This should have failed but did not\n" + exit 1 + } + timeout { + send_user "\nFAILURE: salloc not responding\n" + exit 1 + } + eof { + wait + } + } + + # cancels remaining jobs + cancel_job $job_id1 +} diff --git a/testsuite/expect/inc21.30.7 b/testsuite/expect/inc21.30.7 new file mode 100644 index 0000000000000000000000000000000000000000..bf6cdff57580eb9367bbb13016f4ff8077f1f71a --- /dev/null +++ b/testsuite/expect/inc21.30.7 @@ -0,0 +1,101 @@ +############################################################################ +# Purpose: Test of SLURM functionality +# to be called from test21.30 +# Tests if the MaxJobs limit is enforced +# +# +############################################################################ +# Copyright (C) 2012 SchedMD LLC +# Written by Nathan Yee <nyee32@schedmd.com> +# +# This file is part of SLURM, a resource management program. +# For details, see <http://www.schedmd.com/slurmdocs/>. +# 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. +############################################################################ + +proc inc21_30_7 {} { + +#test MaxJobs limit + + global salloc srun acct bin_sleep jobmatch job_id1 job_id2 job_id3 number exit_code + + set jobmatch 0 + spawn $salloc --account=$acct -n1 $srun $bin_sleep 100 + expect { + -re "Granted job allocation ($number)" { + set job_id1 $expect_out(1,string) + send_user "\njob $job_id1 was submitted\n" + incr jobmatch + } + timeout { + send_user "\nFAILURE: salloc is not responding\n" + exit 1 + } + eof { + wait + } + } + + spawn $salloc --account=$acct -n1 $srun $bin_sleep 100 + expect { + -re "Granted job allocation ($number)" { + set job_id2 $expect_out(1,string) + send_user "\njob $job_id2 was submitted\n" + incr jobmatch + } + timeout { + send_user "\nFAILURE: salloc is not responding\n" + exit 1 + } + eof { + wait + } + } + + spawn $salloc --account=$acct -n1 $srun $bin_sleep 100 + expect { + -re "job ($number)" { + set job_id3 $expect_out(1,string) + send_user "\nThis error is expected do not worry\n" + incr jobmatch + } + -re "Granted job allocation" { + send_user "\nThis should have failed but did not\n" + exit 1 + } + timeout { + send_user "\nFAILURE: salloc is not responding\n" + exit 1 + } + eof { + wait + } + } + + check_state $job_id3 + + if {$jobmatch==0} { + send_user "\nFAILURE: jobs were not submitted\n" + exit 1 + } + + # cancels the remaining jobs + cancel_job $job_id1 + cancel_job $job_id2 + cancel_job $job_id3 + +} diff --git a/testsuite/expect/inc21.30.8 b/testsuite/expect/inc21.30.8 new file mode 100644 index 0000000000000000000000000000000000000000..69c613f630f11d433c054036bcddb16d2796c58d --- /dev/null +++ b/testsuite/expect/inc21.30.8 @@ -0,0 +1,96 @@ +############################################################################ +# Purpose: Test of SLURM functionality +# to be called from test21.30 +# Tests if the MaxJobSubmit limit is enforced +# +# +############################################################################ +# Copyright (C) 2012 SchedMD LLC +# Written by Nathan Yee <nyee32@schedmd.com> +# +# This file is part of SLURM, a resource management program. +# For details, see <http://www.schedmd.com/slurmdocs/>. +# 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. +############################################################################ + +proc inc21_30_8 {} { + +#test MaxJobsSubmits limit + + global salloc srun acct bin_sleep jobmatch job_id1 job_id2 job_id3 number exit_code + + set jobmatch 0 + spawn $salloc --account=$acct -n1 $srun $bin_sleep 100 + expect { + -re "Granted job allocation ($number)" { + set job_id1 $expect_out(1,string) + send_user "\njob $job_id1 was submitted\n" + incr jobmatch + } + timeout { + send_user "\nFAILURE: salloc is not responding\n" + exit 1 + } + eof { + wait + } + } + + spawn $salloc --account=$acct -n1 $srun $bin_sleep 100 + expect { + -re "Granted job allocation ($number)" { + set job_id2 $expect_out(1,string) + send_user "\njob $job_id2 was submitted\n" + incr jobmatch + } + timeout { + send_user "\nFAILURE: salloc is not responding\n" + exit 1 + } + eof { + wait + } + } + + spawn $salloc --account=$acct -n1 $srun $bin_sleep 100 + expect { + -re "error" { + send_user "\nThis error is expected do not worry\n" + incr jobmatch + } + -re "Granted job allocation" { + send_user "\nThis should have failed but did not\n" + exit 1 + } + timeout { + send_user "\nFAILURE: salloc is not responding\n" + exit 1 + } + eof { + wait + } + } + if {$jobmatch==0} { + send_user "\nFAILURE: jobs were not submitted\n" + exit 1 + } + + # cancels the remaining jobs + cancel_job $job_id1 + cancel_job $job_id2 + +} diff --git a/testsuite/expect/test21.30 b/testsuite/expect/test21.30 new file mode 100755 index 0000000000000000000000000000000000000000..3f749a811ebfdb6b02547e164257a15be6ceb83c --- /dev/null +++ b/testsuite/expect/test21.30 @@ -0,0 +1,283 @@ +#!/usr/bin/expect +############################################################################ +# Purpose: Test of SLURM functionality +# Test that checks if the QOS limits are enforced. +# +# 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) 2012 SchedMD LLC +# Written by Nathan Yee <nyee32@schedmd.com> +# +# This file is part of SLURM, a resource management program. +# For details, see <http://www.schedmd.com/slurmdocs/>. +# 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 +source ./globals_accounting +source ./inc21.30.1 +source ./inc21.30.2 +source ./inc21.30.3 +source ./inc21.30.4 +source ./inc21.30.5 +source ./inc21.30.6 +source ./inc21.30.7 +source ./inc21.30.8 + +set test_id "21.30" +set exit_code 0 +set acct test_acct +set job_id1 "" +set job_id2 "" +set job_id3 "" +set user_name "" +set qosname name +set qostest [format "%s %s" $test_id "qosTest"] +set grn GrpNodes +set grn_num 2 +set grcpu GrpCpus +set grcpu_num 10 +set grjobs GrpJobs +set grjobs_num 2 +set grsub GrpSubmit +set grsub_num 2 +set maxcpu MaxCpus +set maxcpu_num 10 +set maxnodes MaxNodes +set maxnode_num 10 +set maxjobs MaxJobs +set maxjobs_num 2 +set maxjobsub MaxSubmitJobs +set maxjobsub_num 2 + +print_header $test_id + +# Checks the state of the job +proc check_state { job } { + + global scontrol job_id exit_code + + set state_match 0 + spawn $scontrol show job $job + expect { + "JobState=PENDING" { + incr state_match + } + timeout { + send_user "\nFAILURE scontrol not responding\n" + set exit_code 1 + } + eof { + wait + } + } + + if {$state_match != 1} { + send_user "\nFAILURE job is running when it should be pending\n" + exit 1 + } + +} + +# modifies the QoS +proc mod_qos { node cpu job sub mcpu mnode mjobs mjobsub } { + + global sacctmgr exit_code qosname qostest grn grcpu grjobs grsub maxcpu maxnodes maxjobs maxjobsub + + set change_cnt 0 + spawn $sacctmgr -i modify qos where $qosname=$qostest set $grn=$node $grcpu=$cpu $grjobs=$job $grsub=$sub $maxcpu=$mcpu $maxnodes=$mnode $maxjobs=$mjobs $maxjobsub=$mjobsub + expect { + -re "Modified qos" { + incr change_cnt + } + timeout { + send_user "\nFAILURE sacctmgr not responding\n" + set exit_code 1 + } + eof { + wait + } + } + if {$change_cnt==0} { + send_user "\nFAILURE: sacctmgr did not change qos $qostest\n" + set exit_code 1 + } + +} + +#gets user +spawn $bin_id -u -n +expect { + -re "($alpha_numeric_under)" { + set user_name $expect_out(1,string) + exp_continue + } + eof { + wait + } +} + +# add qos +set qosmatch 0 +spawn $sacctmgr -i add qos $qosname=$qostest +expect { + -re "Adding QOS" { + incr qosmatch + exp_continue + } + timeout { + send_user "\nFAILURE: sacctmgr did not add QOS\n" + set exit_code 1 + } + eof { + wait + } +} + +#add account with qos +set acctmatch 0 +spawn $sacctmgr -i add account $acct qos=$qostest +expect { + -re "Adding Account" { + incr acctmatch + exp_continue + } + -re "Nothing new added" { + send_user "\nWARNING: vestigial account $acct found\n" + incr acctmatch + exp_continue + } + timeout { + send_user "\nFAILURE: sacctmgr is not responding\n" + set exit_code 1 + } + eof { + wait + + } +} +if {$acctmatch != 1} { + send_user "\nFAILURE: sacctmgr had a problem adding the account\n" + exit 1 +} + +#add user to account +spawn $sacctmgr -i create user name=$user_name account=$acct +expect { + timeout { + send_user "\nFAILURE: sacctmgr not responding\n" + } + eof { + wait + } +} + + +mod_qos $grn_num -1 -1 -1 -1 -1 -1 -1 + +sleep 5 +#test GrpNode limit +inc21_30_1 + + +mod_qos -1 $grcpu_num -1 -1 -1 -1 -1 -1 + +sleep 5 +#test GrpCpus +inc21_30_2 + +mod_qos -1 -1 $grjobs_num -1 -1 -1 -1 -1 + +sleep 5 +# test GrpJob limits +inc21_30_3 + + +mod_qos -1 -1 -1 $grsub_num -1 -1 -1 -1 + +sleep 5 +# test GrpSubmit +inc21_30_4 + + +mod_qos -1 -1 -1 -1 $maxcpu_num -1 -1 -1 + +sleep 5 +#test MaxCpus limits +inc21_30_5 + +mod_qos -1 -1 -1 -1 -1 $maxnode_num -1 -1 + +sleep 5 +#test MaxNode limit +inc21_30_6 + +mod_qos -1 -1 -1 -1 -1 -1 $maxjobs_num -1 + +sleep 5 +#test MaxJobs limit +inc21_30_7 + +mod_qos -1 -1 -1 -1 -1 -1 -1 $maxjobsub_num + +sleep 5 +#test MaxJobsSubmits limit +inc21_30_8 + +# delete qos +spawn $sacctmgr -i delete qos $qostest +expect { + -re "Deleting QOS(s)" { + exp_continue + } + -re "Error" { + send_user "\nFAILURE: QOS was not deleted\n" + } + timeout { + send_user "\nFAILURE: sacctmgr is not responding\n" + } + eof { + wait + } +} + +#delete account +spawn $sacctmgr -i delete account $acct +expect { + -re "Deleting accounts" { + exp_continue + } + -re "Error" { + send_user "\nFAILURE: account was not deleted\n" + set exit_code 1 + } + timeout { + send_user "\nFAILURE: sacctmgr is not responding\n" + set exit_code 1 + } + eof { + wait + } +} + +if {$exit_code==0} { + print_success $test_id +} + +exit $exit_code +