~ubuntu-branches/ubuntu/vivid/slurm-llnl/vivid

« back to all changes in this revision

Viewing changes to testsuite/expect/test24.2

  • Committer: Bazaar Package Importer
  • Author(s): Gennaro Oliva
  • Date: 2009-09-24 23:28:15 UTC
  • mfrom: (1.1.11 upstream) (3.2.4 sid)
  • Revision ID: james.westby@ubuntu.com-20090924232815-enh65jn32q1ebg07
Tags: 2.0.5-1
* New upstream release 
* Changed dependecy from lib-mysqlclient15 to lib-mysqlclient 
* Added Default-Start for runlevel 2 and 4 and $remote_fs requirement in
  init.d scripts (Closes: #541252)
* Postinst checks for wrong runlevels 2 and 4 links
* Upgraded to standard version 3.8.3
* Add lintian overrides for missing slurm-llnl-configurator.html in doc
  base registration
* modified postrm scripts to ignore pkill return value in order to avoid
  postrm failure when no slurm process is running
* Checking for slurmctld.pid before cancelling running and pending
  jobs during package removal 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/expect
 
2
############################################################################
 
3
# Purpose: Test of SLURM sshare functionality
 
4
#          sshare h, p, P, v and V options.
 
5
#
 
6
# Output:  "TEST: #.#" followed by "SUCCESS" if test was successful, OR
 
7
#          "FAILURE: ..." otherwise with an explanation of the failure, OR
 
8
#          anything else indicates a failure mode that must be investigated.
 
9
############################################################################
 
10
# Copyright (C) 2009 Lawrence Livermore National Security.
 
11
# Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
 
12
# Written by Joseph Donaghy <donaghy1@llnl.gov>
 
13
# CODE-OCEC-09-009. All rights reserved.
 
14
 
15
# This file is part of SLURM, a resource management program.
 
16
# For details, see <https://computing.llnl.gov/linux/slurm/>.
 
17
# Please also read the included file: DISCLAIMER.
 
18
#  
 
19
# SLURM is free software; you can redistribute it and/or modify it under
 
20
# the terms of the GNU General Public License as published by the Free
 
21
# Software Foundation; either version 2 of the License, or (at your option)
 
22
# any later version.
 
23
 
24
# SLURM is distributed in the hope that it will be useful, but WITHOUT ANY
 
25
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 
26
# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 
27
# details.
 
28
 
29
# You should have received a copy of the GNU General Public License along
 
30
# with SLURM; if not, write to the Free Software Foundation, Inc.,
 
31
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 
32
############################################################################
 
33
source ./globals
 
34
 
 
35
set test_id     "24.2"
 
36
set exit_code   0
 
37
set timeout 60
 
38
print_header $test_id
 
39
 
 
40
#
 
41
# Check accounting config and bail if not found.
 
42
#
 
43
if { [test_account_storage] == 0 } {
 
44
        send_user "\nWARNING: This test can't be run without a usable AccountStorageType\n"
 
45
        exit 0
 
46
}
 
47
 
 
48
################################################################
 
49
#
 
50
# Proc: sshare_opt
 
51
#
 
52
# Purpose:  Pass sshare options and test
 
53
#
 
54
# Returns: Number of matches.
 
55
#
 
56
# Input: Switch options not requiring arguments
 
57
#
 
58
################################################################
 
59
 
 
60
proc sshare_opt { soption } {
 
61
        global sshare number
 
62
        set debug       1
 
63
        set exit_code   0
 
64
        set matches     0
 
65
        set not_support 0
 
66
        send_user "$sshare -$soption \n"
 
67
 
 
68
        if { $soption == "-help"|| $soption == "-usage" } {
 
69
                
 
70
                spawn $sshare -$soption
 
71
                expect {
 
72
                        -re "SLURM accounting storage is disabled" {
 
73
                                set not_support 1
 
74
                                exp_continue
 
75
                        }
 
76
                        -re "You are not running a supported priority plugin" {
 
77
                                set not_support 2
 
78
                                exp_continue
 
79
                        }
 
80
                        -re "Usage: *sshare *.OPTION" {
 
81
                                if {$debug} {send_user "\nmatch1\n"}
 
82
                                incr matches
 
83
                                exp_continue
 
84
                        }
 
85
                        -re "Valid OPTIONs are" {
 
86
                                if {$debug} {send_user "\nmatch2\n"}
 
87
                                incr matches
 
88
                                exp_continue
 
89
                        }
 
90
                        -re "verbose *display more information" {
 
91
                                if {$debug} {send_user "\nmatch3\n"}
 
92
                                incr matches
 
93
                                exp_continue
 
94
                        }
 
95
                        timeout {
 
96
                                send_user "\nFAILURE: sshare not responding\n"
 
97
                                set exit_code 1
 
98
                        }
 
99
                        eof {
 
100
                                wait
 
101
                        }
 
102
                }
 
103
 
 
104
                if {$not_support == 1} {
 
105
                        send_user "\nWARNING: can not test without accounting enabled\n"
 
106
                        exit 0
 
107
                }
 
108
 
 
109
                if {$not_support == 2} {
 
110
                        send_user "\nWARNING: can not test without priority/multifactor plugin\n"
 
111
                        exit 0
 
112
                }
 
113
 
 
114
                if {$matches != 3} {
 
115
                        send_user "\nFAILURE: sshare -$soption failed ($matches)\n"
 
116
                        set exit_code 1
 
117
                }
 
118
                return $matches
 
119
        }
 
120
 
 
121
        if { $soption == "-noheader" || $soption == "h" } {
 
122
 
 
123
                spawn $sshare -$soption
 
124
                expect {
 
125
                        -re "SLURM accounting storage is disabled" {
 
126
                                set not_support 1
 
127
                                exp_continue
 
128
                        }
 
129
                        -re "You are not running a supported priority plugin" {
 
130
                                set not_support 2
 
131
                                exp_continue
 
132
                        }
 
133
                        -re "Account|User|Raw Shares|Norm Shares|Raw Usage|Norm Usage|Effectv Usage" {  
 
134
                                if {$debug} {send_user "\nmatch4\n"}
 
135
                                incr matches
 
136
                                exp_continue
 
137
                        }
 
138
                        timeout {
 
139
                                send_user "\nFAILURE: sshare not responding\n"
 
140
                                set exit_code 1
 
141
                        }
 
142
                        eof {
 
143
                                wait
 
144
                        }
 
145
                }
 
146
 
 
147
                if {$not_support == 1} {
 
148
                        send_user "\nWARNING: can not test without accounting enabled\n"
 
149
                        exit 0
 
150
                }
 
151
 
 
152
                if {$not_support == 2} {
 
153
                        send_user "\nWARNING: can not test without priority/multifactor plugin\n"
 
154
                        exit 0
 
155
                }
 
156
 
 
157
                if {$matches != 0} {
 
158
                        send_user "\nFAILURE: sshare -$soption failed ($matches)\n"
 
159
                        set exit_code 1
 
160
                }
 
161
                return $matches
 
162
        }
 
163
 
 
164
        if { $soption == "-parsable" || $soption == "p" } {
 
165
 
 
166
                spawn $sshare -$soption
 
167
                expect {
 
168
                        -re "SLURM accounting storage is disabled" {
 
169
                                set not_support 1
 
170
                                exp_continue
 
171
                        }
 
172
                        -re "You are not running a supported priority plugin" {
 
173
                                set not_support 2
 
174
                                exp_continue
 
175
                        }
 
176
                        -re "Account\\|User\\|Raw Shares\\|Norm Shares\\|" {
 
177
                                if {$debug} {send_user "\nmatch5\n"}
 
178
                                incr matches
 
179
                                exp_continue
 
180
                        }
 
181
                        -re "Raw Usage\\|Effectv Usage\\|Fair-share\\|" {
 
182
                                if {$debug} {send_user "\nmatch5\n"}
 
183
                                incr matches
 
184
                                exp_continue
 
185
                        }
 
186
                        timeout {
 
187
                                send_user "\nFAILURE: sshare not responding\n"
 
188
                                set exit_code 1
 
189
                        }
 
190
                        eof {
 
191
                                wait
 
192
                        }
 
193
                }
 
194
 
 
195
                if {$not_support != 0} {
 
196
                        send_user "\nWARNING: can not test without accounting enabled\n"
 
197
                        exit 0
 
198
                }
 
199
                if {$matches != 2} {
 
200
                        send_user "\nFAILURE: sshare -$soption failed ($matches)\n"
 
201
                        set exit_code 1
 
202
                }
 
203
                return $matches
 
204
        }
 
205
 
 
206
        if { $soption == "-parsable2" || $soption == "P" } {
 
207
 
 
208
                spawn $sshare -$soption
 
209
                expect {
 
210
                        -re "SLURM accounting storage is disabled" {
 
211
                                set not_support 1
 
212
                                exp_continue
 
213
                        }
 
214
                        -re "You are not running a supported priority plugin" {
 
215
                                set not_support 2
 
216
                                exp_continue
 
217
                        }
 
218
                        -re "Account\\|User\\|Raw Shares\\|Norm Shares\\|" {
 
219
                                if {$debug} {send_user "\nmatch6\n"}
 
220
                                incr matches
 
221
                                exp_continue
 
222
                        }
 
223
                        -re "Raw Usage\\|Effectv Usage\\|Fair-share" {
 
224
                                if {$debug} {send_user "\nmatch7\n"}
 
225
                                incr matches
 
226
                                exp_continue
 
227
                        }
 
228
                        timeout {
 
229
                                send_user "\nFAILURE: sshare not responding\n"
 
230
                                set exit_code 1
 
231
                        }
 
232
                        eof {
 
233
                                wait
 
234
                        }
 
235
                }
 
236
 
 
237
                if {$not_support == 1} {
 
238
                        send_user "\nWARNING: can not test without accounting enabled\n"
 
239
                        exit 0
 
240
                }
 
241
 
 
242
                if {$not_support == 2} {
 
243
                        send_user "\nWARNING: can not test without priority/multifactor plugin\n"
 
244
                        exit 0
 
245
                }
 
246
 
 
247
                if {$matches != 2} {
 
248
                        send_user "\nFAILURE: sshare -$soption failed ($matches)\n"
 
249
                        set exit_code 1
 
250
                }
 
251
                return $matches
 
252
        }
 
253
 
 
254
        if { $soption == "-verbose" || $soption == "v" } {
 
255
 
 
256
                spawn $sshare -$soption
 
257
                expect {
 
258
                        -re "SLURM accounting storage is disabled" {
 
259
                                set not_support 1
 
260
                                exp_continue
 
261
                        }
 
262
                        -re "You are not running a supported priority plugin" {
 
263
                                set not_support 2
 
264
                                exp_continue
 
265
                        }
 
266
                        -re "Users requested" {
 
267
                                if {$debug} {send_user "\nmatch8\n"}
 
268
                                incr matches
 
269
                                exp_continue
 
270
                        }
 
271
                        -re "Accounts requested" {
 
272
                                if {$debug} {send_user "\nmatch9\n"}
 
273
                                incr matches
 
274
                                exp_continue
 
275
                        }
 
276
                        -re "sshare: .* loaded" {
 
277
                                if {$debug} {send_user "\nmatch10\n"}
 
278
                                incr matches
 
279
                                exp_continue
 
280
                        }
 
281
                        timeout {
 
282
                                send_user "\nFAILURE: sshare not responding\n"
 
283
                                set exit_code 1
 
284
                        }
 
285
                        eof {
 
286
                                wait
 
287
                        }
 
288
                }
 
289
 
 
290
                if {$not_support == 1} {
 
291
                        send_user "\nWARNING: can not test without accounting enabled\n"
 
292
                        exit 0
 
293
                }
 
294
 
 
295
                if {$not_support == 2} {
 
296
                        send_user "\nWARNING: can not test without priority/multifactor plugin\n"
 
297
                        exit 0
 
298
                }
 
299
 
 
300
                if {$matches != 3} {
 
301
                        send_user "\nFAILURE: sshare -$soption failed ($matches)\n"
 
302
                        set exit_code 1
 
303
                }
 
304
                return $matches
 
305
        }
 
306
 
 
307
 
 
308
        if { $soption == "-version" || $soption == "V" } {
 
309
 
 
310
                spawn $sshare -$soption
 
311
                expect {
 
312
                        -re "SLURM accounting storage is disabled" {
 
313
                                set not_support 1
 
314
                                exp_continue
 
315
                        }
 
316
                        -re "You are not running a supported priority plugin" {
 
317
                                set not_support 2
 
318
                                exp_continue
 
319
                        }
 
320
                        -re "slurm $number.$number.$number" {
 
321
                                if {$debug} {send_user "\nmatch11\n"}
 
322
                                incr matches
 
323
                                exp_continue
 
324
                        }
 
325
                        timeout {
 
326
                                send_user "\nFAILURE: sshare not responding\n"
 
327
                                set exit_code 1
 
328
                        }
 
329
                        eof {
 
330
                                wait
 
331
                        }
 
332
                }
 
333
 
 
334
                if {$not_support == 1} {
 
335
                        send_user "\nWARNING: can not test without accounting enabled\n"
 
336
                        exit 0
 
337
                }
 
338
 
 
339
                if {$not_support == 2} {
 
340
                        send_user "\nWARNING: can not test without priority/multifactor plugin\n"
 
341
                        exit 0
 
342
                }
 
343
 
 
344
                if {$matches != 1} {
 
345
                        send_user "\nFAILURE: sshare -$soption failed ($matches)\n"
 
346
                        set exit_code 1
 
347
                }
 
348
                return $matches
 
349
        }
 
350
}
 
351
 
 
352
################################################################
 
353
 
 
354
set matches [sshare_opt -help ]
 
355
if {$matches != 3} {
 
356
        send_user "\nFAILURE: sshare --help failed ($matches)\n"
 
357
        set exit_code 1
 
358
}
 
359
 
 
360
set matches [sshare_opt -usage ]
 
361
if {$matches != 3} {
 
362
        send_user "\nFAILURE: sshare --usage failed ($matches)\n"
 
363
        set exit_code 1
 
364
}
 
365
 
 
366
set matches [sshare_opt h ]
 
367
if {$matches != 0} {
 
368
        send_user "\nFAILURE: sshare -n failed ($matches)\n"
 
369
        set exit_code 1
 
370
}
 
371
 
 
372
set matches [sshare_opt -noheader ]
 
373
if {$matches != 0} {
 
374
        send_user "\nFAILURE: sshare --noheader failed ($matches)\n"
 
375
        set exit_code 1
 
376
}
 
377
 
 
378
set matches [sshare_opt p ]
 
379
if {$matches != 2} {
 
380
        send_user "\nFAILURE: sshare -p failed ($matches)\n"
 
381
        set exit_code 1
 
382
}
 
383
 
 
384
set matches [sshare_opt -parsable ]
 
385
if {$matches != 2} {
 
386
        send_user "\nFAILURE: sshare --parsable failed ($matches)\n"
 
387
        set exit_code 1
 
388
}
 
389
 
 
390
set matches [sshare_opt P ]
 
391
if {$matches != 2} {
 
392
        send_user "\nFAILURE: sshare -P failed ($matches)\n"
 
393
        set exit_code 1
 
394
}
 
395
 
 
396
set matches [sshare_opt -parsable2 ]
 
397
if {$matches != 2} {
 
398
        send_user "\nFAILURE: sshare --parsable2 failed ($matches)\n"
 
399
        set exit_code 1
 
400
}
 
401
 
 
402
set matches [sshare_opt v ]
 
403
if {$matches != 3} {
 
404
        send_user "\nFAILURE: sshare -v failed ($matches)\n"
 
405
        set exit_code 1
 
406
}
 
407
 
 
408
set matches [sshare_opt -verbose ]
 
409
if {$matches != 3} {
 
410
        send_user "\nFAILURE: sshare --verbose failed ($matches)\n"
 
411
        set exit_code 1
 
412
}
 
413
 
 
414
 
 
415
set matches [sshare_opt V ]
 
416
if {$matches != 1} {
 
417
        send_user "\nFAILURE: sshare -v failed ($matches)\n"
 
418
        set exit_code 1
 
419
}
 
420
 
 
421
set matches [sshare_opt -version ]
 
422
if {$matches != 1} {
 
423
        send_user "\nFAILURE: sshare --verbose failed ($matches)\n"
 
424
        set exit_code 1
 
425
}
 
426
 
 
427
if {$exit_code == 0} {
 
428
        send_user "\nSUCCESS\n"
 
429
}
 
430
exit $exit_code