diff --git a/testsuite/expect/README b/testsuite/expect/README index a0d6b0581447647884222dd83c933e5b99212d3c..0e3091202c39384517ce87f2658054c57d9e7166 100644 --- a/testsuite/expect/README +++ b/testsuite/expect/README @@ -342,6 +342,12 @@ test15.7 Test of processors, memory, and temporary disk space test15.8 Test of immediate allocation option (--immediate option). test15.9 Confirm that salloc exit code processing. test15.10 Confirm that a job allocates the proper procesor count (--nprocs) +test15.11 Test of processors, memory, and temporary disk space + constraints options (--mincpus, --mem, and --tmp options). +test15.12 Verify node configuration specification (--constraint option). +test15.13 Verify the appropriate job environment variables are set +test15.TBD Verify that SLURM directed environment variables are processed: + SBATCH_NNODES, etc. test16.# Testing of sattach options. @@ -417,5 +423,20 @@ test18.5 Confirm that slauch local stdin, stdout, and stderr options work (options --local-input, --local-output and --local-error respectively). test18.6 Test of slaunch verbose mode (-v option). -test18.7 Test of srun/slurmd debug mode (--debug option). +test18.7 Test of slaunch/slurmd debug mode (--debug option). +test18.8 Confirm that slaunch buffering can be disabled (--unbuffered option). +test18.9 Test of wait option (--wait option). +test18.10 Test slaunch stdout/err disabling (--output and --error options + with argument of "none"). +test18.11 Test slaunch stdout/err file name formatting (--local-output and + --local-error options with %j, %J, %n, %s and %t specifications). +test18.12 Test slaunch stdin routing to specific task (--local-input option + with numeric argument). +test18.13 Confirm that a job executes with various launch thread fanouts + (--threads option). +test18.14 Verify the appropriate job environment variables are set +test18.15 Verify that user environment variables are propagated to the job +test18.16 Verify that user user limits are propagated to the job +test18.TBD Verify that SLURM directed environment variables are processed: + SBATCH_NNODES, etc. diff --git a/testsuite/expect/test1.15 b/testsuite/expect/test1.15 index 89fae393a4ff1c345d4827f065a1dd1f76f6bfd6..cd693c8c11e91d51fd65742cc4279b923b3550c5 100755 --- a/testsuite/expect/test1.15 +++ b/testsuite/expect/test1.15 @@ -54,10 +54,10 @@ make_bash_script $file_in " " # -# Spawn a shell via srun and send exit command to task 1 only +# Spawn tasks via srun and immediately exit task 1 only # set timeout $max_job_delay -spawn $srun -n10 -N1 -O -W2 -t5 $file_in +spawn $srun -n10 -N1 -O -W2 -t2 $file_in expect { -re "First task exited" { send_user "This error is expected, no worries\n" @@ -80,7 +80,7 @@ expect { } if {$matches != 2} { - send_user "\nFAILURE: problem with wait option\n" + send_user "\nFAILURE: problem with srun wait option\n" set exit_code 1 } if {$exit_code == 0} { diff --git a/testsuite/expect/test1.19 b/testsuite/expect/test1.19 index 16cddc70762d140b0cd454e315f13e403881c1e5..6e723d432effeaa395cd7a05e975302a65b131d4 100755 --- a/testsuite/expect/test1.19 +++ b/testsuite/expect/test1.19 @@ -7,9 +7,6 @@ # 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.19.*.output and test1.19.*.error ############################################################################ # Copyright (C) 2002-2006 The Regents of the University of California. # Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). @@ -49,7 +46,7 @@ set task_cnt 5 print_header $test_id # -# Spawn a shell via srun that includes "task_id" (%t) in stdout file name +# Spawn a program that generates "task_id" (%t) in stdout file names # and confirm they are created # for {set task_id 0} {$task_id < $task_cnt} {incr task_id} { diff --git a/testsuite/expect/test1.20 b/testsuite/expect/test1.20 index 0cd485841347b5638a8bdceba76a30e32f88f1d0..4da9969de2af45a57aeb65c517979d3753168e9a 100755 --- a/testsuite/expect/test1.20 +++ b/testsuite/expect/test1.20 @@ -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. @@ -38,7 +38,7 @@ set exit_code 0 print_header $test_id # -# Spawn a shell via srun with stdout forwarding disabled +# Spawn a program via srun with stdout forwarding disabled # set timeout $max_job_delay spawn $srun --output=none -t1 $bin_id @@ -65,9 +65,9 @@ expect { } # -# Spawn a shell via srun with stderr forwarding disabled +# Spawn a program via srun with stderr forwarding disabled # -set srun_exit 0 +set matches 0 spawn $srun --error=none -t1 $bin_sleep aaa expect { -re "invalid" { @@ -77,7 +77,7 @@ expect { } -re "exit code $number" { send_user "This error is expected, no worries\n" - set srun_exit 1 + set matches 1 exp_continue } timeout { @@ -91,7 +91,7 @@ expect { } } -if {$srun_exit == 0} { +if {$matches != 1} { send_user "\nFAILURE: srun exit code does not indicate error\n" set exit_code 1 } diff --git a/testsuite/expect/test1.22 b/testsuite/expect/test1.22 index 4b22087b9080f3a017123c6d62d99baad016ae6d..1e0f2c5ef806b35c2e4045e091086411abed644e 100755 --- a/testsuite/expect/test1.22 +++ b/testsuite/expect/test1.22 @@ -66,6 +66,7 @@ expect { exp_continue } eof { + wait } } @@ -82,7 +83,7 @@ if {[string compare $host_0 ""] == 0} { # set host_0 "" set timeout $max_job_delay -spawn $srun -N$node_cnt -l --threads=32 -t1 $bin_hostname +spawn $srun -N$node_cnt -n32 -O -l --threads=32 -t1 $bin_hostname expect { -re "0: ($alpha_numeric)" { set host_0 $expect_out(1,string) @@ -95,6 +96,7 @@ expect { exp_continue } eof { + wait } } diff --git a/testsuite/expect/test15.11 b/testsuite/expect/test15.11 new file mode 100755 index 0000000000000000000000000000000000000000..db83181f35d87ce9e0026c31ae63a6649475b849 --- /dev/null +++ b/testsuite/expect/test15.11 @@ -0,0 +1,125 @@ +#!/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 "15.11" +set exit_code 0 +set job_id 0 + +set cpu_cnt 1 +set mem_size 13 +set tmp_size 2 +set matches 0 + +print_header $test_id + +# +# Spawn a salloc job with constraints +# +spawn $salloc --mincpus=$cpu_cnt --mem=$mem_size --tmp=$tmp_size --hold -t1 $bin_bash +expect { + -re "Pending job allocation ($number)" { + set job_id $expect_out(1,string) + } + timeout { + send_user "\nFAILURE: salloc not responding\n" + exit 1 + } +} +if {$job_id == 0} { + send_user "\nFAILURE: salloc 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} { + send_user "\nSUCCESS\n" +} +exit $exit_code diff --git a/testsuite/expect/test15.12 b/testsuite/expect/test15.12 new file mode 100755 index 0000000000000000000000000000000000000000..91613f66cb4ce38a6f23589758e90433c76fc367 --- /dev/null +++ b/testsuite/expect/test15.12 @@ -0,0 +1,80 @@ +#!/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 "15.12" +set exit_code 0 +set file_in "test$test_id.input" + +print_header $test_id + +# +# Submit a job with invalid constraint requirement +# +set err_msg 0 +set timeout $max_job_delay +spawn $salloc -N1 -t1 --constraint=invalid,constraint salloc -t1 $bin_bash +expect { + -re "configuration is not available" { + send_user "This error is expected, no worries\n" + set err_msg 1 + exp_continue + } + -re "Granted job allocation ($number).*" { + send_user "\nFAILURE: salloc job submitted with invalid constraint\n" + set exit_code 1 + send "exit\n" + } + -re "Pending job allocation ($number)" { + send_user "\nFAILURE: salloc job submitted with invalid constraint\n" + set exit_code 1 + exp_continue + } + timeout { + send_user "\nFAILURE: salloc 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} { + send_user "\nSUCCESS\n" +} +exit $exit_code diff --git a/testsuite/expect/test15.13 b/testsuite/expect/test15.13 new file mode 100755 index 0000000000000000000000000000000000000000..94fac2df8eff1a4a3c9031d2d5405f5d17d0ecd0 --- /dev/null +++ b/testsuite/expect/test15.13 @@ -0,0 +1,147 @@ +#!/usr/bin/expect +############################################################################ +# Purpose: Test of SLURM functionality +# Verify the appropriate job environment variables are set +# +# 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 "15.13" +set exit_code 0 +set matches 0 + +print_header $test_id + +# +# Spawn a job via salloc to print environment variables +# +set job_id 0 +spawn $salloc -N1 -t1 $bin_env +expect { + -re "Granted job allocation ($number)" { + set job_id $expect_out(1,string) + exp_continue + } + -re "SLURM_($alpha_under)=($alpha_numeric)" { + if {[string compare $expect_out(1,string) "CPUS_ON_NODE"] == 0 + && $expect_out(2,string) > 0} { + incr matches + exp_continue + } + if {[string compare $expect_out(1,string) "CPUS_PER_TASK"] == 0 + && $expect_out(2,string) > 0} { + incr matches + exp_continue + } + if {[string compare $expect_out(1,string) "JOBID"] == 0 + && $expect_out(2,string) > 0} { + incr matches + exp_continue + } + if {[string compare $expect_out(1,string) "LAUNCH_NODE_IPADDR"] == 0} { + incr matches + exp_continue + } + if {[string compare $expect_out(1,string) "LOCALID"] == 0} { + incr matches + exp_continue + } + if {[string compare $expect_out(1,string) "NNODES"] == 0 + && $expect_out(2,string) > 0} { + incr matches + exp_continue + } + if {[string compare $expect_out(1,string) "NODEID"] == 0} { + incr matches + exp_continue + } + if {[string compare $expect_out(1,string) "NODELIST"] == 0} { + incr matches + exp_continue + } + if {[string compare $expect_out(1,string) "NPROCS"] == 0 + && $expect_out(2,string) > 0} { + incr matches + exp_continue + } + if {[string compare $expect_out(1,string) "PROCID"] == 0} { + incr matches + exp_continue + } + if {[string compare $expect_out(1,string) "SRUN_COMM_HOST"] == 0} { + incr matches + exp_continue + } + if {[string compare $expect_out(1,string) "SRUN_COMM_PORT"] == 0 + && $expect_out(2,string) > 0} { + incr matches + exp_continue + } + if {[string compare $expect_out(1,string) "STEPID"] == 0} { + incr matches + exp_continue + } + if {[string compare $expect_out(1,string) "TASKS_PER_NODE"] == 0 + && $expect_out(2,string) > 0} { + incr matches + exp_continue + } + if {[string compare $expect_out(1,string) "TASK_PID"] == 0 + && $expect_out(2,string) > 0} { + incr matches + exp_continue + } + if {[string compare $expect_out(1,string) "UMASK"] == 0} { + incr matches + exp_continue + } + exp_continue + } + timeout { + send_user "\nFAILURE: salloc not responding\n" + if {$job_id == 0} { + kill_salloc + } else { + cancel_job $job_id + } + set exit_code 1 + exp_continue + } + eof { + wait + } +} +if {$matches != 16} { + send_user "\nFAILURE: Not all SLURM environment variables set ($matches of 16)\n" + set exit_code 1 +} + +if {$exit_code == 0} { + send_user "\nSUCCESS\n" +} +exit $exit_code diff --git a/testsuite/expect/test17.15 b/testsuite/expect/test17.15 index 44185d864861257a80c3889e25c26b38fd121e0c..b7efcf315e234a8fcf988ca6f271983683475b22 100755 --- a/testsuite/expect/test17.15 +++ b/testsuite/expect/test17.15 @@ -10,7 +10,7 @@ # Note: AIX does not support the NPROC limit, but this test should # otherwise succeed ############################################################################ -# 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. diff --git a/testsuite/expect/test18.10 b/testsuite/expect/test18.10 new file mode 100755 index 0000000000000000000000000000000000000000..d3529915f6b31d7474f0752ac7452d14862b1887 --- /dev/null +++ b/testsuite/expect/test18.10 @@ -0,0 +1,116 @@ +#!/usr/bin/expect +############################################################################ +# Purpose: Test of SLURM functionality +# Test slaunch stdout/err disabling (--output and --error options +# with argument of "none"). +# +# 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 "18.10" +set exit_code 0 +set job_id 0 + +print_header $test_id + +# +# Spawn a program via slaunch with stdout forwarding disabled +# +set timeout $max_job_delay +spawn $salloc -t1 -v $slaunch --local-output=none $bin_id +expect { + -re "Granted job allocation ($number)" { + set job_id $expect_out(1,string) + exp_continue + } + -re "uid=" { + send_user "\nFAILURE: slaunch improperly forwarded stdout\n" + set exit_code 1 + exp_continue + } + -re "groups=" { + send_user "\nFAILURE: slaunch improperly forwarded stdout\n" + set exit_code 1 + exp_continue + } + timeout { + send_user "\nFAILURE: salloc not responding\n" + if {$job_id == 0} { + kill_salloc + } else { + cancel_job $job_id + } + set exit_code 1 + exp_continue + } + eof { + wait + } +} + +# +# Spawn a program via slaunch with stderr forwarding disabled +# +set job_id 0 +set matches 0 +spawn $salloc -t1 -v $slaunch --local-error=none -t1 $bin_sleep aaa +expect { + -re "invalid" { + send_user "\nFAILURE: srun improperly forwarded stderr\n" + set exit_code 1 + exp_continue + } + -re "exit code $number" { + send_user "This error is expected, no worries\n" + set matches 1 + exp_continue + } + timeout { + send_user "\nFAILURE: salloc not responding\n" + if {$job_id == 0} { + kill_salloc + } else { + cancel_job $job_id + } + set exit_code 1 + exp_continue + } + eof { + wait + } +} + +if {$matches != 1} { + send_user "\nFAILURE: slaunch exit code does not indicate error\n" + set exit_code 1 +} + +if {$exit_code == 0} { + send_user "\nSUCCESS\n" +} +exit $exit_code diff --git a/testsuite/expect/test18.11 b/testsuite/expect/test18.11 new file mode 100755 index 0000000000000000000000000000000000000000..f77a01774f3f044868b4d22cc132b6c57e99a7d4 --- /dev/null +++ b/testsuite/expect/test18.11 @@ -0,0 +1,314 @@ +#!/usr/bin/expect +############################################################################ +# Purpose: Test of SLURM functionality +# Test slaunch stdout/err file name formatting (--local-output and +# --local-error options with %j, %J, %n, %s and %t specifications). +# +# 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 "18.11" +set exit_code 0 +set file_err_j "test$test_id.j.%j.error" +set file_in "test$test_id.input" +set file_out_J "test$test_id.J.%J.output" +set file_out_n "test$test_id.n.%n.output" +set file_out_s "test$test_id.s.%s.output" +set file_out_t "test$test_id.t.%t.output" +set job_id 0 +set task_cnt 5 + +print_header $test_id + +# +# Spawn a program that includes "task_id" (%t) in stdout file names +# and confirm they are created +# +for {set task_id 0} {$task_id < $task_cnt} {incr task_id} { + set file_out_t_glob "test$test_id.t.$task_id.output" + exec $bin_rm -f $file_out_t_glob +} +set timeout $max_job_delay +spawn $salloc -N1 -t1 -v $slaunch --local-output=$file_out_t -n$task_cnt --overcommit $bin_id +expect { + -re "Granted job allocation ($number)" { + set job_id $expect_out(1,string) + exp_continue + } + timeout { + send_user "\nFAILURE: salloc not responding\n" + if {$job_id == 0} { + kill_salloc + } else { + cancel_job $job_id + } + set exit_code 1 + exp_continue + } + eof { + wait + } +} +if {$job_id == 0} { + send_user "\nFAILURE: job initiation failed\n" + exit 1 +} + +set file_cnt 0 +for {set task_id 0} {$task_id < $task_cnt} {incr task_id} { + set file_out_t_glob "test$test_id.t.$task_id.output" + if {[wait_for_file $file_out_t_glob] != 0} { + set exit_code 1 + } else { + exec $bin_rm -f $file_out_t_glob + incr file_cnt + } +} +if {$file_cnt != $task_cnt} { + send_user "\nFAILURE: file format of %t in stdout failed\n" + set exit_code 1 +} + +# +# Spawn a program that includes "jobid" (%j) in stderr file name +# and confirm it is created +# +set job_id 0 +set matches 0 +spawn $salloc -N1 -t1 -v $slaunch --local-output=/dev/null --local-error=$file_err_j -n$task_cnt --overcommit $bin_sleep aaa +expect { + -re "Granted job allocation ($number)" { + set job_id $expect_out(1,string) + exp_continue + } + -re "exit code $number" { + send_user "This error is expected, no worries\n" + set matches 1 + exp_continue; + } + timeout { + send_user "\nFAILURE: salloc not responding\n" + if {$job_id == 0} { + kill_salloc + } else { + cancel_job $job_id + } + exit 1 + } + eof { + wait + } +} +if {$job_id == 0} { + send_user "\nFAILURE: job initiation failed\n" + exit 1 +} +if {$matches == 0} { + send_user "\nFAILURE: exit code failed to indicate an error\n" + set exit_code 1 +} + +set file_err_j_glob "test$test_id.j.$job_id.error" +if {[wait_for_file $file_err_j_glob] == 0} { + exec $bin_rm -f $file_err_j_glob +} else { + send_user "\nFAILURE: file format of %j in stderr failed\n" + set exit_code 1 +} + +# +# Spawn a program that includes "job_id.step_id" (%J) in stdout +# file name and confirm it is created +# +set job_id 0 +spawn $salloc -N1 -t1 -v $slaunch --local-output=$file_out_J $bin_hostname +expect { + -re "Granted job allocation ($number)" { + set job_id $expect_out(1,string) + exp_continue + } + timeout { + send_user "\nFAILURE: salloc not responding\n" + if {$job_id == 0} { + kill_salloc + } else { + cancel_job $job_id + } + exit 1 + } + eof { + wait + } +} +if {$job_id == 0} { + send_user "\nFAILURE: job initiation failed\n" + exit 1 +} +set task_id 0 +set file_out_J_glob "test$test_id.J.$job_id.$task_id.output" +if {[wait_for_file $file_out_J_glob] != 0} { + send_user "\nFAILURE: file format of %J in stdout failed\n" + set exit_code 1 +} else { + exec $bin_rm -f $file_out_J_glob +} + +# +# Spawn a program that includes "node_id" (%n) in stdout +# file name and confirm it is created +# +set node_id 0 +set file_out_n_glob "test$test_id.n.$node_id.output" +exec $bin_rm -f $file_out_n_glob + +set job_id 0 +spawn $salloc -N1 -t1 -v $slaunch --local-output=$file_out_n -n2 --overcommit $bin_hostname +expect { + -re "Granted job allocation ($number)" { + set job_id $expect_out(1,string) + exp_continue + } + timeout { + send_user "\nFAILURE: salloc not responding\n" + if {$job_id == 0} { + kill_salloc + } else { + cancel_job $job_id + } + exit 1 + } + eof { + wait + } +} +if {$job_id == 0} { + send_user "\nFAILURE: job initiation failed\n" + exit 1 +} +set file_cnt 0 +for {set node_id 0} {$node_id < 2} {incr node_id} { + set file_out_n_glob "test$test_id.n.$node_id.output" + + if {($node_id == 0) && ([wait_for_file $file_out_n_glob] != 0)} { + send_user "\nFAILURE: Missing file $file_out_n_glob\n" + set exit_code 1 + } else { + exec $bin_sleep 1 + } + if [file exists $file_out_n_glob] { + exec $bin_rm -f $file_out_n_glob + incr file_cnt + } +} + +if {$file_cnt != 1} { + send_user "\nFAILURE: file format of %n in stdout failed\n" + set exit_code 1 +} + +# +# Spawn a program that includes "step_id" (%s) in stdout +# file name and confirm it is created. Use two step batch job. +# +make_bash_script $file_in " + $slaunch -n4 --overcommit --local-output=$file_out_s $bin_hostname + $slaunch -n4 --overcommit --local-output=$file_out_s $bin_hostname +" + +for {set step_id 0} {$step_id < 4} {incr step_id} { + set file_out_s_glob "test$test_id.s.$step_id.output" + exec $bin_rm -f $file_out_s_glob +} + +if { [test_bluegene] } { + set node_cnt 32-2048 + set task_cnt 32 +} else { + if { [test_xcpu] } { + set node_cnt 1-1 + } else { + set node_cnt 1-4 + } + set task_cnt 4 +} + +set job_id 0 +spawn $sbatch --output=/dev/null -N$node_cnt -t1 $file_in +expect { + -re "Submitted batch job ($number)" { + set job_id $expect_out(1,string) + exp_continue + } + timeout { + send_user "\nFAILURE: srun not responding\n" + kill_srun + exit 1 + } + eof { + wait + } +} +if {$job_id == 0} { + send_user "\nFAILURE: job initiation failed\n" + exit 1 +} else { + if {[wait_for_job $job_id DONE] != 0} { + send_user "\nFAILURE: error on job\n" + set exit_code 1 + } +} + +set file_cnt 0 +for {set step_id 0} {$step_id < 3} {incr step_id} { + set file_out_s_glob "test$test_id.s.$step_id.output" + + if {($step_id < 2) && ([wait_for_file $file_out_s_glob] != 0)} { + send_user "\nFAILURE: Missing file $file_out_s_glob\n" + set exit_code 1 + } else { + exec $bin_sleep 1 + } + if [file exists $file_out_s_glob] { + exec $bin_rm -f $file_out_s_glob + incr file_cnt + } +} + +if {$file_cnt != 2} { + send_user "\nFAILURE: file format of %s in stdout failed($file_cnt)\n" + set exit_code 1 +} + +# +# Post-processing +# +if {$exit_code == 0} { + exec $bin_rm -f $file_in + send_user "\nSUCCESS\n" +} +exit $exit_code diff --git a/testsuite/expect/test18.12 b/testsuite/expect/test18.12 new file mode 100755 index 0000000000000000000000000000000000000000..a43ab70c8e73c6f0e53b6dfc3137f9a6d8014dff --- /dev/null +++ b/testsuite/expect/test18.12 @@ -0,0 +1,92 @@ +#!/usr/bin/expect +############################################################################ +# Purpose: Test of SLURM functionality +# Test slaunch stdin routing to specific task (--local-input option +# with numeric argument). +# +# 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 "18.12" +set exit_code 0 +set job_id 0 +set matches 0 +set task_id 3 + +print_header $test_id + +# +# Spawn a shell via slaunch with stdout forwarding disabled +# +set timeout $max_job_delay +spawn $salloc -v -N1 -t1 $slaunch -n10 --overcommit --wait=2 --local-input=3 $bin_bash +expect { + -re "Submitted batch job ($number)" { + set job_id $expect_out(1,string) + send "$bin_env\n" + exp_continue + } + -re "SLURM_PROCID=($number)" { + set proc_id $expect_out(1,string) + if {$task_id == $proc_id} { + incr matches + } else { + send_user "\nFAILURE: wrong task_id responded\n" + set exit_code 1 + } + send "exit\n" + exp_continue + } + -re "error: First task exited" { + send_user "This error is expected, no worries\n" + exp_continue + } + timeout { + send_user "\nFAILURE: salloc not responding\n" + if {$job_id == 0} { + kill_salloc + } else { + cancel_job $job_id + } + set exit_code 1 + exp_continue + } + eof { + wait + } +} + +if {$matches != 1} { + send_user "\nFAILURE: specific task_id failed to respond\n" + set exit_code 1 +} + +if {$exit_code == 0} { + send_user "\nSUCCESS\n" +} +exit $exit_code diff --git a/testsuite/expect/test18.13 b/testsuite/expect/test18.13 new file mode 100755 index 0000000000000000000000000000000000000000..1c3172bd447bd48f38b3bd072bc9d415dca935dd --- /dev/null +++ b/testsuite/expect/test18.13 @@ -0,0 +1,132 @@ +#!/usr/bin/expect +############################################################################ +# Purpose: Test of SLURM functionality +# Confirm that a job executes with various launch thread fanouts +# (--threads 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 "18.13" +set exit_code 0 + +print_header $test_id + +# +# Submit a job with one thread fanout +# +set host_0 "" +set timeout $max_job_delay +if { [test_bluegene] } { + set node_cnt 32-32k +} else { + if { [test_xcpu] } { + set node_cnt 1-1 + } else { + set node_cnt 1-64 + } +} + +set job_id 0 +spawn $salloc -v -t1 -N$node_cnt $slaunch -l --threads=1 $bin_hostname +expect { + -re "Granted job allocation ($number)" { + set job_id $expect_out(1,string) + exp_continue + } + -re "0: ($alpha_numeric)" { + set host_0 $expect_out(1,string) + exp_continue + } + timeout { + send_user "\nFAILURE: salloc not responding\n" + if {$job_id == 0} { + kill_salloc + } else { + cancel_job $job_id + } + set exit_code 1 + exp_continue + } + eof { + wait + } +} + +# +# Verify node registration +# +if {[string compare $host_0 ""] == 0} { + send_user "\nFAILURE: Did not get hostname of task 0\n" + set exit_code 1 +} + +# +# Submit a job with 32 thread fanout +# +set job_id 0 +set host_0 "" +set timeout $max_job_delay +spawn $salloc -v -N$node_cnt -t1 $slaunch -n32 --overcommit -l --threads=32 $bin_hostname +expect { + -re "Granted job allocation ($number)" { + set job_id $expect_out(1,string) + exp_continue + } + -re "0: ($alpha_numeric)" { + set host_0 $expect_out(1,string) + exp_continue + } + timeout { + send_user "\nFAILURE: salloc not responding\n" + if {$job_id == 0} { + kill_salloc + } else { + cancel_job $job_id + } + set exit_code 1 + exp_continue + } + eof { + wait + } +} + +# +# Verify node registration +# +if {[string compare $host_0 ""] == 0} { + send_user "\nFAILURE: Did not get hostname of task 0\n" + set exit_code 1 +} + +if {$exit_code == 0} { + send_user "\nSUCCESS\n" +} +exit $exit_code diff --git a/testsuite/expect/test18.14 b/testsuite/expect/test18.14 new file mode 100755 index 0000000000000000000000000000000000000000..726571ac65e966328a48cea27fe11ac7e36e25b7 --- /dev/null +++ b/testsuite/expect/test18.14 @@ -0,0 +1,148 @@ +#!/usr/bin/expect +############################################################################ +# Purpose: Test of SLURM functionality +# Verify the appropriate job environment variables are set +# +# 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 "18.14" +set exit_code 0 +set job_id 0 +set matches 0 +set timeout $max_job_delay + +print_header $test_id + +# +# Spawn a job via salloc to print environment variables +# +spawn $salloc -N1 -t1 $slaunch $bin_env +expect { + -re "Granted job allocation ($number)" { + set job_id $expect_out(1,string) + exp_continue + } + -re "SLURM_($alpha_under)=($alpha_numeric)" { + if {[string compare $expect_out(1,string) "CPUS_ON_NODE"] == 0 + && $expect_out(2,string) > 0} { + incr matches + exp_continue + } + if {[string compare $expect_out(1,string) "CPUS_PER_TASK"] == 0 + && $expect_out(2,string) > 0} { + incr matches + exp_continue + } + if {[string compare $expect_out(1,string) "JOBID"] == 0 + && $expect_out(2,string) > 0} { + incr matches + exp_continue + } + if {[string compare $expect_out(1,string) "LAUNCH_NODE_IPADDR"] == 0} { + incr matches + exp_continue + } + if {[string compare $expect_out(1,string) "LOCALID"] == 0} { + incr matches + exp_continue + } + if {[string compare $expect_out(1,string) "NNODES"] == 0 + && $expect_out(2,string) > 0} { + incr matches + exp_continue + } + if {[string compare $expect_out(1,string) "NODEID"] == 0} { + incr matches + exp_continue + } + if {[string compare $expect_out(1,string) "NODELIST"] == 0} { + incr matches + exp_continue + } + if {[string compare $expect_out(1,string) "NPROCS"] == 0 + && $expect_out(2,string) > 0} { + incr matches + exp_continue + } + if {[string compare $expect_out(1,string) "PROCID"] == 0} { + incr matches + exp_continue + } + if {[string compare $expect_out(1,string) "SRUN_COMM_HOST"] == 0} { + incr matches + exp_continue + } + if {[string compare $expect_out(1,string) "SRUN_COMM_PORT"] == 0 + && $expect_out(2,string) > 0} { + incr matches + exp_continue + } + if {[string compare $expect_out(1,string) "STEPID"] == 0} { + incr matches + exp_continue + } + if {[string compare $expect_out(1,string) "TASKS_PER_NODE"] == 0 + && $expect_out(2,string) > 0} { + incr matches + exp_continue + } + if {[string compare $expect_out(1,string) "TASK_PID"] == 0 + && $expect_out(2,string) > 0} { + incr matches + exp_continue + } + if {[string compare $expect_out(1,string) "UMASK"] == 0} { + incr matches + exp_continue + } + exp_continue + } + timeout { + send_user "\nFAILURE: salloc not responding\n" + if {$job_id == 0} { + kill_salloc + } else { + cancel_job $job_id + } + set exit_code 1 + exp_continue + } + eof { + wait + } +} +if {$matches != 16} { + send_user "\nFAILURE: Not all SLURM environment variables set ($matches of 16)\n" + set exit_code 1 +} + +if {$exit_code == 0} { + send_user "\nSUCCESS\n" +} +exit $exit_code diff --git a/testsuite/expect/test18.15 b/testsuite/expect/test18.15 new file mode 100755 index 0000000000000000000000000000000000000000..8ed5b670d4747c09f8ba80739b94fa54f438785c --- /dev/null +++ b/testsuite/expect/test18.15 @@ -0,0 +1,86 @@ +#!/usr/bin/expect +############################################################################ +# Purpose: Test of SLURM functionality +# Verify that user environment variables are propagated to the job +# +# 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 "18.15" +set test_env_name "TEST_ENV_$test_id" +set test_env_val 123 +set exit_code 0 +set job_id 0 +set matches 0 +set timeout $max_job_delay + +global env +set env($test_env_name) $test_env_val + +print_header $test_id + +# +# Spawn a job via sbatch to print environment variables +# +set env($test_env_name) $test_env_val +spawn $salloc -N1 -t1 -v $slaunch $bin_env +expect { + -re "Granted job allocation ($number)" { + set job_id $expect_out(1,string) + exp_continue + } + -re "$test_env_name=($number)" { + if {$expect_out(1,string) == $test_env_val} { + incr matches + } + exp_continue + } + timeout { + send_user "\nFAILURE: salloc not responding\n" + if {$job_id == 0} { + kill_salloc + } else { + cancel_job $job_id + } + set exit_code 1 + exp_continue + } + eof { + wait + } +} + +if {$matches != 1} { + send_user "\nFAILURE: Environment variables not propagated\n" + set exit_code 1 +} + +if {$exit_code == 0} { + send_user "\nSUCCESS\n" +} +exit $exit_code diff --git a/testsuite/expect/test18.16 b/testsuite/expect/test18.16 new file mode 100755 index 0000000000000000000000000000000000000000..60c747ee88a8a8d7a92836ea84e1808b56411161 --- /dev/null +++ b/testsuite/expect/test18.16 @@ -0,0 +1,196 @@ +#!/usr/bin/expect +############################################################################ +# Purpose: Test of SLURM functionality +# Verify that user user limits are propagated to the job +# +# 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: AIX does not support the NPROC limit, but this test should +# otherwise succeed +############################################################################ +# 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 "18.16" +set exit_code 0 +set job_id 0 +set limit_core 943 +set limit_fsize 274515 +set limit_nofile 1016 +set limit_nproc 123 +set limit_stack 2021 +set matches 0 +set file_in "test$test_id.input" +set file_prog_get "test$test_id.prog" +set timeout $max_job_delay + +print_header $test_id + +# +# Delete left-over programs and rebuild them. +# We use our own program to get ulimit values since the output +# of the ulimit program is inconsistent across systems. +# +exec $bin_rm -f $file_prog_get +exec $bin_make -f /dev/null $file_prog_get + +# +# Get our current limits and adjust targets accordingly +# +set cur_core -1 +set cur_fsize -1 +set cur_nofile -1 +set cur_nproc -1 +set cur_stack -1 +spawn ./$file_prog_get +expect { + -re "USER_CORE=($number)" { + set cur_core $expect_out(1,string) + exp_continue + } + -re "USER_FSIZE=($number)" { + set cur_fsize $expect_out(1,string) + exp_continue + } + -re "USER_NOFILE=($number)" { + set cur_nofile $expect_out(1,string) + exp_continue + } + -re "USER_NPROC=($number)" { + set cur_nproc $expect_out(1,string) + exp_continue + } + -re "USER_STACK=($number)" { + set cur_stack $expect_out(1,string) + exp_continue + } +} +if {$cur_core != -1} { + if {$cur_core == 0} { + set limit_core 0 + } else { + set limit_core [expr ($cur_core / 1024) - 2] + } +} +if {$cur_fsize != -1} { + if {$cur_fsize == 0} { + set limit_fsize 0 + } else { + set limit_fsize [expr ($cur_fsize / 1024) - 2] + } +} +if {$cur_nofile != -1} { + set limit_nofile [expr $cur_nofile - 2] +} +if {$cur_nproc != -1} { + set limit_nproc [expr $cur_nproc - 2] +} +if {$cur_stack != -1} { + set limit_stack [expr ($cur_stack / 1024) - 2] +} + +# +# Spawn a job via salloc/slaunch to print environment variables and +# user limits +# +make_bash_script $file_in " + ulimit -c $limit_core + ulimit -f $limit_fsize + ulimit -n $limit_nofile + ulimit -u $limit_nproc + ulimit -s $limit_stack + ./$file_prog_get +" + +spawn $salloc -N1 -t1 -v $slaunch ./$file_in +expect { + -re "Granted job allocation ($number)" { + set job_id $expect_out(1,string) + exp_continue + } + -re "USER_CORE=($number)" { + if {$expect_out(1,string) == [expr $limit_core * 1024]} { + incr matches + } + exp_continue + } + -re "USER_FSIZE=($number)" { + if {$expect_out(1,string) == [expr $limit_fsize * 1024]} { + incr matches + } + exp_continue + } + -re "USER_NOFILE=($number)" { + if {$expect_out(1,string) == $limit_nofile} { + incr matches + } + exp_continue + } + -re "USER_NPROC=($number)" { + if {$expect_out(1,string) == $limit_nproc} { + incr matches + } + exp_continue + } + -re "USER_NPROC unsupported" { + incr matches + exp_continue + } + -re "USER_STACK=($number)" { + if {$expect_out(1,string) == [expr $limit_stack * 1024]} { + incr matches + } + exp_continue + } + -re "USER_STACK unsupported" { + incr matches + exp_continue + } + timeout { + send_user "\nFAILURE: salloc not responding\n" + if {$job_id == 0} { + kill_salloc + } else { + cancel_job $job_id + } + set exit_code 1 + exp_continue + } + eof { + wait + } +} + +if {$matches != 5} { + send_user "\nFAILURE: User limits not propagated\n" + set exit_code 1 +} + +if {$exit_code == 0} { + exec $bin_rm -f $file_in $file_prog_get + send_user "\nSUCCESS\n" +} +exit $exit_code diff --git a/testsuite/expect/test18.16.prog.c b/testsuite/expect/test18.16.prog.c new file mode 100644 index 0000000000000000000000000000000000000000..ceef5185a6685d3191060c3855780da5715eb20e --- /dev/null +++ b/testsuite/expect/test18.16.prog.c @@ -0,0 +1,59 @@ +/*****************************************************************************\ + * proc1.29.proc.c - Simple user limit set program for SLURM regression + * test1.29. Get the core, fsize, nofile, and nproc limits and print their + * values in the same format as SLURM environment variables. + ***************************************************************************** + * Copyright (C) 2002 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. +\*****************************************************************************/ +#include <stdio.h> +#include <stdlib.h> +#include <sys/time.h> +#include <sys/resource.h> +#include <unistd.h> + +main (int argc, char **argv) +{ + struct rlimit u_limit; + int exit_code = 0; + + (void) getrlimit(RLIMIT_CORE, &u_limit); + printf("USER_CORE=%d\n", u_limit.rlim_cur); + (void) getrlimit(RLIMIT_FSIZE, &u_limit); + printf("USER_FSIZE=%d\n", u_limit.rlim_cur); + (void) getrlimit(RLIMIT_NOFILE, &u_limit); + printf("USER_NOFILE=%d\n", u_limit.rlim_cur); +#ifdef RLIMIT_NPROC + (void) getrlimit(RLIMIT_NPROC, &u_limit); + printf("USER_NPROC=%d\n", u_limit.rlim_cur); +#else + printf("USER_NPROC unsupported\n"); +#endif +#ifdef RLIMIT_STACK + (void) getrlimit(RLIMIT_STACK, &u_limit); + printf("USER_STACK=%d\n", u_limit.rlim_cur); +#else + printf("USER_STACK unsupported\n"); +#endif + + exit(exit_code); +} diff --git a/testsuite/expect/test18.7 b/testsuite/expect/test18.7 index 0578cff48fa48c7ded1fb0bdcbcafca2c5b22d8c..d71f2988f419f0bc0259c3e9d280c119ce9d2cf7 100755 --- a/testsuite/expect/test18.7 +++ b/testsuite/expect/test18.7 @@ -1,7 +1,7 @@ #!/usr/bin/expect ############################################################################ # Purpose: Test of SLURM functionality -# Test of slaunch debug mode (-d option). +# Test of slaunch/slurmd debug mode (--debug option). # # Output: "TEST: #.#" followed by "SUCCESS" if test was successful, OR # "FAILURE: ..." otherwise with an explanation of the failure, OR diff --git a/testsuite/expect/test18.8 b/testsuite/expect/test18.8 new file mode 100755 index 0000000000000000000000000000000000000000..4eff5345ef97980b98b5418d196a1dec1cac2468 --- /dev/null +++ b/testsuite/expect/test18.8 @@ -0,0 +1,86 @@ +#!/usr/bin/expect +############################################################################ +# Purpose: Test of SLURM functionality +# Confirm that slaunch buffering can be disabled (--unbuffered 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 "18.8" +set exit_code 0 +set job_id 0 +set matches 0 +set scratch_file "scratch.$test_id" + +print_header $test_id + +# +# Create a scratch file +# +exec $bin_touch $scratch_file + +# +# Submit a slurm job that will execute 'rm -i' +# The --unbuffered option will send the message which lacks a '\n' +# +set timeout $max_job_delay +spawn $salloc -v -t1 $slaunch --unbuffered $bin_rm -i $scratch_file +expect { + -re "Granted job allocation ($number)" { + set job_id $expect_out(1,string) + exp_continue + } + -re "\[Rr\]emove .*\?" { + set matches 1 + send "y\n" + exp_continue + } + timeout { + send_user "\nFAILURE: slaunch not responding\n" + kill_salloc + set exit_code 1 + exp_continue + } + eof { + wait + } +} + +# +# Confirm message send before '\n' (unbuffered). +# + +if {$matches != 1} { + send_user "\nFAILURE: slaunch --unbuffered option failure\n" + exec $bin_rm -f $scratch_file + set exit_code 1 +} +if {$exit_code == 0} { + send_user "\nSUCCESS\n" +} +exit $exit_code diff --git a/testsuite/expect/test18.9 b/testsuite/expect/test18.9 new file mode 100755 index 0000000000000000000000000000000000000000..c5de580f3313e0e5cd119dcddd65fd06edcdc293 --- /dev/null +++ b/testsuite/expect/test18.9 @@ -0,0 +1,96 @@ +#!/usr/bin/expect +############################################################################ +# Purpose: Test of SLURM functionality +# Test of wait option (--wait 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 "18.9" +set exit_code 0 +set file_in "test$test_id.input" +set job_id 0 +set matches 0 + +print_header $test_id + +# +# Delete left-over input script +# Build input script file +# +exec $bin_rm -f $file_in +make_bash_script $file_in " + if ((\$SLURM_PROCID == 1)) + then exit + fi + $bin_sleep 300 +" + +# +# Spawn tasks via slaunch and immediately exit task 1 only +# +set timeout $max_job_delay +spawn $salloc -N1 -t2 -v $slaunch -n10 --overcommit -W2 $file_in +expect { + -re "Granted job allocation ($number)" { + set job_id $expect_out(1,string) + exp_continue + } + -re "First task exited" { + send_user "This error is expected, no worries\n" + incr matches + exp_continue + } + -re "task.0,2-9.: running" { # bracket escape not working + incr matches + exp_continue + } + timeout { + send_user "\nFAILURE: slaunch not responding\n" + if {$job_id == 0} { + kill_salloc + } else { + cancel_job $job_id + } + set exit_code 1 + exp_continue + } + eof { + wait + } +} + +if {$matches != 2} { + send_user "\nFAILURE: problem with slaunch wait option\n" + set exit_code 1 +} +if {$exit_code == 0} { + exec $bin_rm -f $file_in + send_user "\nSUCCESS\n" +} +exit $exit_code