Skip to content
Snippets Groups Projects
Commit d704d5b8 authored by Christopher J. Morrone's avatar Christopher J. Morrone
Browse files

Add test of srun --jobid for an EXISTING allocation

parent 592f256e
No related branches found
No related tags found
No related merge requests found
......@@ -134,7 +134,8 @@ test1.54 Test of running different executables with different arguments
test1.55 Make certain that srun behaves when its controlling terminal
disappears.
test1.56 Test buffered standard IO with really long lines
test1.57 Test of --jobid option (used by Moab)
test1.57 Test of srun --jobid for a new job allocation (used by Moab)
test1.58 Test of srun --jobid for an existing job allocation
**NOTE** The following tests attempt to utilize multiple CPUs or partitions,
The test will print "WARNING" and terminate with an exit code of
......
#!/usr/bin/expect
############################################################################
# Purpose: Test of SLURM functionality
# Test of srun --jobid option with an existing allocation
#
# 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 Christopher J. Morrone <morrone2@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.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
############################################################################
source ./globals
set test_id "1.58"
set exit_code 0
print_header $test_id
set timeout $max_job_delay
#
# Run an srun to grab a single node allocation, but not start any
# job steps.
#
set srun_alloc_pid [spawn $srun -v -N1 -n1 -A $bin_sleep 600]
set srun_alloc_sid $spawn_id
expect {
-re "srun: jobid ($number)" {
set jobid $expect_out(1,string)
}
timeout {
send_user "\nFAILURE: srun failed to grab an allocation in a timely manner.\n"
kill $srun_alloc_pid
exit 1
}
}
#
# Now try to use the srun --jobid option to run in the already existing
# allocation.
#
set pattern "sdiouetj49udfj"
set got_pattern 0
set srun_launch_pid [spawn $srun --jobid $jobid echo $pattern]
expect {
-re "error" {
send_user "\nFAILURE: unexpected error occurred\n"
set exit_code 1
}
-re $pattern {
set got_pattern 1
exp_continue
}
timeout {
kill $srun_launch_pid
kill $srun_launch_pid
kill -9 $srun_launch_pid
}
eof {
wait
}
}
if {$got_pattern == 0} {
send_user "\nFAILURE: unable to srun step under existing job allocation\n"
set exit_code 1
}
#
# Release the allocation by killing the first srun (really it kills the "sleep")
#
kill $srun_alloc_pid
set spawn_id $srun_alloc_sid
expect {
timeout {
kill -9 $srun_alloc_pid
}
eof {
wait
}
}
exit $exit_code
......@@ -103,7 +103,7 @@ make_bash_script $file_in "
#
set timeout [expr $max_job_delay + $sleep_time]
set job_id 0
spawn $salloc -t1 --kill-command $file_in
spawn $salloc -t1 --kill-command ./$file_in
expect {
-re "Granted job allocation ($number)" {
set job_id $expect_out(1,string)
......@@ -131,7 +131,7 @@ expect {
set completions 0
set job_id 0
spawn $salloc -t4 --kill-command $file_in
spawn $salloc -t4 --kill-command ./$file_in
expect {
-re "Granted job allocation ($number)" {
set job_id $expect_out(1,string)
......@@ -161,7 +161,7 @@ if {$completions != 1} {
}
if {$exit_code == 0} {
exec $bin_rm -f $file_in
file delete $file_in
send_user "\nSUCCESS\n"
}
exit $exit_code
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment