File: test1.54

package info (click to toggle)
slurm-wlm 22.05.8-4%2Bdeb12u3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 48,492 kB
  • sloc: ansic: 475,246; exp: 69,020; sh: 8,862; javascript: 6,528; python: 6,444; makefile: 4,185; perl: 4,069; pascal: 131
file content (196 lines) | stat: -rwxr-xr-x 5,133 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
#!/usr/bin/env expect
############################################################################
# Purpose: Test of Slurm functionality
#          Test of MPMD (--multi-prog option).
############################################################################
# Copyright (C) 2006 The Regents of the University of California.
# Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
# Written by Morris Jette <jette1@llnl.gov>
# CODE-OCEC-09-009. All rights reserved.
#
# This file is part of Slurm, a resource management program.
# For details, see <https://slurm.schedmd.com/>.
# 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

set file_in     "$test_dir/input"
set job_id      0

if {[get_config_param "FrontendName"] ne "MISSING"} {
	skip "This test is incompatible with front-end systems"
}

proc cleanup {} {
	global job_id

	cancel_job $job_id
}

#
# Delete left-over input script
# Build input script file
#
set file [open $file_in "w"]
puts $file "# multi-program configuration file
1-2   $bin_echo task:%t:offset:%o
0,3   $bin_echo task:%t:offset:%o
"
close $file
exec $bin_chmod 700 $file_in

#
# Submit a slurm job that will execute different programs and arguments by task number
#
set matches 0
set timeout $max_job_delay
spawn $srun -N1 -n4 --overcommit -l -t1 --multi-prog $file_in
expect {
	-re "($number): *task:($number):offset:($number)" {
		set label       $expect_out(1,string)
		set task_id     $expect_out(2,string)
		set task_offset $expect_out(3,string)
		if {$label == 0 && $task_id == 0 && $task_offset == 0} {
			incr matches
		}
		if {$label == 1 && $task_id == 1 && $task_offset == 0} {
			incr matches
		}
		if {$label == 2 && $task_id == 2 && $task_offset == 1} {
			incr matches
		}
		if {$label == 3 && $task_id == 3 && $task_offset == 1} {
			incr matches
		}
		exp_continue
	}
	timeout {
		fail "srun not responding"
	}
	eof {
		wait
	}
}

subtest {$matches == 4} "Expecting multi-program output" "$matches != 4"

#
# Submit a slurm job that will execute different executables and check debug info
#
# Timeout is max_job_delay (to spawn task) +
#       60 (job time limit) +
#       60 (slurmctld time limit check poll interval) +
#       KillWait
#
set timeout [expr $max_job_delay + 60 + 60 + 60]

exec $bin_rm -f $file_in
set file [open $file_in "w"]
puts $file "# multi-program configuration file
1-2   $bin_hostname
0,3   $bin_date
"
close $file
exec $bin_chmod 700 $file_in

set matches   0
set srun_pid [spawn $srun -N1 -n4 --overcommit -l -t1 --multi-prog --debugger-test -v $file_in]
expect {
	-re "launching StepId=($number)\\.($re_word_str)" {
		set job_id $expect_out(1,string)
		exp_continue
	}
	-re "executable:($re_word_str)" {
		if {$expect_out(1,string) ne "date"} {
			incr matches
		}
		if {$expect_out(1,string) ne "hostname"} {
			incr matches
		}
		if {$matches == 4} {
			slow_kill $srun_pid
		}
		exp_continue
	}
	timeout {
		fail "srun not responding"
	}
	eof {
		wait
	}
}
if {$job_id == 0} {
	fail "Failed to get job id"
}

subtest {$matches == 4} "Expecting to generate full list of executables" "$matches != 4"

#
# Submit a slurm job that asks for more tasks than specified in our
# configuration file
#
set matches   0
spawn $srun -N1 -n5 --overcommit -l -t1 --multi-prog $file_in
expect {
	-re "Configuration file .* invalid" {
		log_debug "No worries. This error is expected"
		incr matches
	}
	timeout {
		fail "srun not responding"
	}
	eof {
		wait
	}
}

subtest {$matches == 1} "Srun output should note lack of an executable for task 5"

exec $bin_rm -f $file_in
set file [open $file_in "w"]
puts $file "# multi-program configuration file
1-2   $bin_hostname
0,3   $bin_echo aaaa \
task:%t:\\
offset:%o \\
bbbb
"
close $file
exec $bin_chmod 700 $file_in

set matches   0
spawn $srun -N1 -n4 --overcommit -l -t1 --multi-prog $file_in
expect {
	-re "($number): aaaa task:($number):offset:($number) bbbb" {
		if {$expect_out(1,string) == 0 && $expect_out(2,string) == 0 && $expect_out(3,string) == 0} {
			incr matches
		} elseif {$expect_out(1,string) == 3 && $expect_out(2,string) == 3 && $expect_out(3,string) == 1} {
			incr matches
		} else {
			log_error "Processing MPMD line continuation"
		}
		exp_continue
	}
	timeout {
		fail "srun not responding"
	}
	eof {
		wait
	}
}

subtest {$matches == 2} "Should not process MPMD line continuation" "$matches != 2"