|
Line 0
Link Here
|
|
|
1 |
#!/usr/bin/expect |
| 2 |
############################################################################ |
| 3 |
# Purpose: Test of SLURM functionality |
| 4 |
# Bluegene/Q only: Test to make sure that the correct number of |
| 5 |
# nodes and tasks in a job and a step. |
| 6 |
# |
| 7 |
# Output: "TEST: #.#" followed by "SUCCESS" if test was successful, OR |
| 8 |
# "FAILURE: ..." otherwise with an explanation of the failure, OR |
| 9 |
# anything else indicates a failure mode that must be investigated. |
| 10 |
############################################################################ |
| 11 |
# Copyright (C) 2011 SchedMD LLC |
| 12 |
# Written by Nathan Yee <nyee32@schedmd.com> |
| 13 |
# |
| 14 |
# This file is part of SLURM, a resource management program. |
| 15 |
# For details, see <http://www.schedmd.com/slurmdocs/>. |
| 16 |
# Please also read the included file: DISCLAIMER. |
| 17 |
# |
| 18 |
# SLURM is free software; you can redistribute it and/or modify it under |
| 19 |
# the terms of the GNU General Public License as published by the Free |
| 20 |
# Software Foundation; either version 2 of the License, or (at your option) |
| 21 |
# any later version. |
| 22 |
# |
| 23 |
# SLURM is distributed in the hope that it will be useful, but WITHOUT ANY |
| 24 |
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 25 |
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
| 26 |
# details. |
| 27 |
# |
| 28 |
# You should have received a copy of the GNU General Public License along |
| 29 |
# with SLURM; if not, write to the Free Software Foundation, Inc., |
| 30 |
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 31 |
############################################################################ |
| 32 |
source ./globals |
| 33 |
|
| 34 |
set test_id "8.10" |
| 35 |
set exit_code 0 |
| 36 |
set file_in "test$test_id.input" |
| 37 |
set job_id 0 |
| 38 |
|
| 39 |
print_header $test_id |
| 40 |
|
| 41 |
if {([test_bluegene] == 0) || [string compare [get_bluegene_type] "Q"]} { |
| 42 |
send_user "\nWARNING: This test is only compatible with bluegene systems\n" |
| 43 |
exit 1 |
| 44 |
} |
| 45 |
|
| 46 |
#submit a step with 512 tasks |
| 47 |
spawn $srun -n512 -v $bin_sleep 50 |
| 48 |
expect { |
| 49 |
-re "jobid ($number)" { |
| 50 |
set job_id $expect_out(1,string) |
| 51 |
send_user "\nGot job id $job_id\n" |
| 52 |
} |
| 53 |
timeout { |
| 54 |
send_user "\nFAILURE: srun is not responding\n" |
| 55 |
exit 1 |
| 56 |
} |
| 57 |
eof { |
| 58 |
wait |
| 59 |
} |
| 60 |
} |
| 61 |
|
| 62 |
#wait for job to start |
| 63 |
sleep 10 |
| 64 |
|
| 65 |
#Checks the job steps |
| 66 |
set matches 0 |
| 67 |
spawn $scontrol show step $job_id |
| 68 |
expect { |
| 69 |
-re "Nodes=($number)" { |
| 70 |
set tmp1 $expect_out(1,string) |
| 71 |
if {$tmp1!=32} { |
| 72 |
send_user "\nFAILURE: NumNodes is not 32\n" |
| 73 |
exit 1 |
| 74 |
} else { |
| 75 |
incr matches |
| 76 |
} |
| 77 |
exp_continue |
| 78 |
} |
| 79 |
-re "Tasks=($number)" { |
| 80 |
set tmp2 $expect_out(1,string) |
| 81 |
if {$tmp2!=512} { |
| 82 |
send_user "\nFAILURE: NumCPUs is not 512\n" |
| 83 |
exit 1 |
| 84 |
} else { |
| 85 |
incr matches |
| 86 |
} |
| 87 |
exp_continue |
| 88 |
} |
| 89 |
-re "not found" { |
| 90 |
send_user "\nFAILURE: step was not found\n" |
| 91 |
exit 1 |
| 92 |
} |
| 93 |
timeout { |
| 94 |
send_user "\nFAILURE: scontrol not responding\n" |
| 95 |
exit 1 |
| 96 |
} |
| 97 |
eof { |
| 98 |
wait |
| 99 |
} |
| 100 |
} |
| 101 |
|
| 102 |
if {$matches !=0} { |
| 103 |
send_user "\nNumber of nodes and tasks are correct\n" |
| 104 |
} |
| 105 |
|
| 106 |
#submit allocation and runs job |
| 107 |
set matches 0 |
| 108 |
spawn $salloc -n512 $srun $bin_sleep |
| 109 |
expect { |
| 110 |
-re "Granted job allocation ($number)" { |
| 111 |
set job_id $expect_out(1,string) |
| 112 |
incr matches |
| 113 |
} |
| 114 |
timeout { |
| 115 |
send_user "\nFAILURE: salloc is not responding\n" |
| 116 |
exit 1 |
| 117 |
} |
| 118 |
eof { |
| 119 |
wait |
| 120 |
} |
| 121 |
} |
| 122 |
|
| 123 |
if {$matches !=1} { |
| 124 |
send_user "\nFAILURE: jobs were not submitted\n" |
| 125 |
exit 1 |
| 126 |
} |
| 127 |
|
| 128 |
#Checks job |
| 129 |
set matches 0 |
| 130 |
spawn $scontrol show job $job_id |
| 131 |
expect { |
| 132 |
-re "NumNodes=($number)" { |
| 133 |
set tmp1 $expect_out(1,string) |
| 134 |
if {$tmp1!=32} { |
| 135 |
send_user "\nFAILURE: NumNodes is not 32\n" |
| 136 |
exit 1 |
| 137 |
} else { |
| 138 |
incr matches |
| 139 |
} |
| 140 |
exp_continue |
| 141 |
} |
| 142 |
-re "NumCPUs=($number)" { |
| 143 |
set tmp2 $expect_out(1,string) |
| 144 |
if {$tmp2!=512} { |
| 145 |
send_user "\nFAILURE: NumCPUs is not 512\n" |
| 146 |
exit 1 |
| 147 |
} else { |
| 148 |
incr matches |
| 149 |
} |
| 150 |
exp_continue |
| 151 |
} |
| 152 |
-re "CPUs/Task=($number)" { |
| 153 |
set tmp3 $expect_out(1,string) |
| 154 |
if {$tmp3!=1} { |
| 155 |
send_user "\nFAILURE: CPUs per Task is not 1\n" |
| 156 |
exit 1 |
| 157 |
} else { |
| 158 |
incr matches |
| 159 |
} |
| 160 |
exp_continue |
| 161 |
} |
| 162 |
timeout { |
| 163 |
send_user "\nFAILURE: scontrol not responding\n" |
| 164 |
exit 1 |
| 165 |
} |
| 166 |
eof { |
| 167 |
wait |
| 168 |
} |
| 169 |
} |
| 170 |
if {$matches !=0} { |
| 171 |
send_user "\nNumber of nodes and tasks are correct\n" |
| 172 |
} |
| 173 |
|
| 174 |
if {$exit_code == 0} { |
| 175 |
send_user "\nSUCCESS\n" |
| 176 |
} else { |
| 177 |
send_user "\nFAILURE\n" |
| 178 |
} |
| 179 |
|
| 180 |
exit $exit_code |