Skip to content
Snippets Groups Projects
Commit ff685b9d authored by Moe Jette's avatar Moe Jette
Browse files

relocate_to_slurm_trunk

parent fc6d6119
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/expect
############################################################################
# Purpose: Test of SLURM functionality
# Confirm node selection from within a job step on existing allocation
# (--relative, --nodes and --nprocs options).
#
# 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 The Regents of the University of California.
# Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
# Written by Morris Jette <jette1@llnl.gov>
# UCRL-CODE-2002-040.
#
# 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 "1.87"
set exit_code 0
set file_in "test$test_id.input"
set prompt "SLURM_QA_PROMPT: "
print_header $test_id
if {[test_front_end] != 0} {
send_user "\nWARNING: This test is incompatable with front-end systems\n"
exit 0
}
#
# Delete left-over input script file
# Build input script file
#
exec $bin_rm -f $file_in
exec echo "#!$bin_bash" >$file_in
exec echo "export PS1=\"$prompt\" " >>$file_in
exec echo "$bin_bash -norc" >>$file_in
exec $bin_chmod 700 $file_in
#
# Submit a 4 node job
#
set timeout $max_job_delay
spawn $srun -N4 -A $file_in
expect {
-re "More ($alpha) requested than permitted" {
send_user "\nWARNING: can't test srun task distribution\n"
exec $bin_rm -f $file_in
exit $exit_code
}
-re "configuration not available" {
send_user "WARNING: partition too small for test\n"
kill_srun
exit 0
}
-re "Unable to contact" {
send_user "\nFAILURE: slurm appears to be down\n"
exit 1
}
"$prompt" {
send_user "Job initiated\n"
}
timeout {
send_user "\nFAILURE: srun not responding\n"
kill_srun
exec $bin_rm -f $file_in
exit 1
}
eof {
send_user "\nFAILURE: srun terminated\n"
kill_srun
exec $bin_rm -f $file_in
exit 1
}
}
exec $bin_rm -f $file_in
#
# Get node names
#
set host_0 ""
set host_1 ""
set host_2 ""
set host_3 ""
send "$srun -l $bin_hostname\n"
expect {
-re "($number): ($alpha_numeric)" {
set host_num $expect_out(1,string)
if { $host_num == 0 } {
set host_0 $expect_out(2,string)
}
if { $host_num == 1 } {
set host_1 $expect_out(2,string)
}
if { $host_num == 2 } {
set host_2 $expect_out(2,string)
}
if { $host_num == 3 } {
set host_3 $expect_out(2,string)
}
exp_continue
}
-re "Unable to contact" {
send_user "\nFAILURE: slurm appears to be down\n"
exit 1
}
"$prompt" {
send_user "srun completed\n"
}
timeout {
send_user "\nFAILURE: srun not responding\n"
kill_srun
exit 1
}
eof {
wait
}
}
#
# Verify node count
#
if {[string compare $host_0 ""] == 0} {
send_user "\nFAILURE: Did not get hostname of task 0\n"
set exit_code 1
}
if {[string compare $host_1 ""] == 0} {
send_user "\nFAILURE: Did not get hostname of task 1\n"
set exit_code 1
}
if {[string compare $host_2 ""] == 0} {
send_user "\nFAILURE: Did not get hostname of task 2\n"
set exit_code 1
}
if {[string compare $host_3 ""] == 0} {
send_user "\nFAILURE: Did not get hostname of task 3\n"
set exit_code 1
}
if {$exit_code != 0} {
exit $exit_code
}
#send_user "\nhost_0:$host_0:host_1:$host_1:host_2:$host_2:host_3:$host_3:\n"
#
# Get two nodes relative (starting at) node 0
#
set matches 0
send "$srun -l -N2 -n2 --relative=0 $bin_hostname\n"
expect {
-re "($number): ($alpha_numeric)" {
set host_num $expect_out(1,string)
if { $host_num == 0 } {
if {[string compare $expect_out(2,string) $host_0] == 0} {
incr matches
} else {
send_user "\nFAILURE: wrong node responded\n"
set exit_code 1
}
}
if { $host_num == 1 } {
if {[string compare $expect_out(2,string) $host_1] == 0} {
incr matches
} else {
send_user "\nFAILURE: wrong node responded\n"
set exit_code 1
}
}
if { $host_num > 1 } {
send_user "\nFAILURE: too many tasks responded\n"
set exit_code 1
}
exp_continue
}
-re "Unable to contact" {
send_user "\nFAILURE: slurm appears to be down\n"
exit 1
}
"$prompt" {
send_user "srun completed\n"
}
timeout {
send_user "\nFAILURE: srun not responding\n"
kill_srun
exit 1
}
eof {
wait
}
}
if {$matches < 2} {
send_user "\nFAILURE: required nodes failed to respond\n"
set exit_code 1
}
#
# Get two nodes relative (starting at) node 2
#
set matches 0
send "$srun -l -N2 -n2 --relative=2 $bin_hostname\n"
expect {
-re "($number): ($alpha_numeric)" {
set host_num $expect_out(1,string)
if { $host_num == 0 } {
if {[string compare $expect_out(2,string) $host_2] == 0} {
incr matches
} else {
send_user "\nFAILURE: wrong node responded\n"
set exit_code 1
}
}
if { $host_num == 1 } {
if {[string compare $expect_out(2,string) $host_3] == 0} {
incr matches
} else {
send_user "\nFAILURE: wrong node responded\n"
set exit_code 1
}
}
if { $host_num > 1 } {
send_user "\nFAILURE: too many tasks responded\n"
set exit_code 1
}
exp_continue
}
-re "Unable to contact" {
send_user "\nFAILURE: slurm appears to be down\n"
exit 1
}
"$prompt" {
send_user "srun completed\n"
}
timeout {
send_user "\nFAILURE: srun not responding\n"
kill_srun
exit 1
}
eof {
wait
}
}
if {$matches < 2} {
send_user "\nFAILURE: required nodes failed to respond\n"
set exit_code 1
}
#
# Get two nodes relative (starting at) node 3
# Since there is only one node left, we check for a warning message
#
set matches 0
set warning 0
send "$srun -l -N2 -n2 --relative=3 $bin_hostname\n"
expect {
-re "Warning:" {
set warning 1
exp_continue
}
-re "($number): ($alpha_numeric)" {
if { $host_num == 0 } {
if {[string compare $expect_out(2,string) $host_3] == 0} {
incr matches
} else {
send_user "\nFAILURE: wrong node responded\n"
set exit_code 1
}
}
if { $host_num == 1 } {
if {[string compare $expect_out(2,string) $host_3] == 0} {
incr matches
} else {
send_user "\nFAILURE: wrong node responded\n"
set exit_code 1
}
}
if { $host_num > 1 } {
send_user "\nFAILURE: too many tasks responded\n"
set exit_code 1
}
exp_continue
}
-re "Unable to contact" {
send_user "\nFAILURE: slurm appears to be down\n"
exit 1
}
"$prompt" {
send_user "srun completed\n"
}
timeout {
send_user "\nFAILURE: srun not responding\n"
kill_srun
exit 1
}
eof {
wait
}
}
if {$matches < 2} {
send_user "\nFAILURE: required nodes failed to respond\n"
set exit_code 1
}
if {$warning < 1} {
send_user "\nFAILURE: warning message missing for inconsistent node count\n"
set exit_code 1
}
#
# Post-processing
#
send "exit\n"
expect {
timeout {
send_user "\nFAILURE: srun not responding\n"
kill_srun
exit 1
}
eof {
wait
}
}
if {$exit_code == 0} {
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