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

« back to all changes in this revision

Viewing changes to testsuite/expect/test21.26

  • 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 functionality
 
4
#          sacctmgr +=, -= modify QoS test
 
5
#          
 
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) 2009 Lawrence Livermore National Security.
 
12
# Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
 
13
# Written by Joseph Donaghy <donaghy1@llnl.gov>
 
14
# CODE-OCEC-09-009. All rights reserved.
 
15
 
16
# This file is part of SLURM, a resource management program.
 
17
# For details, see <https://computing.llnl.gov/linux/slurm/>.
 
18
# Please also read the included file: DISCLAIMER.
 
19
#  
 
20
# SLURM is free software; you can redistribute it and/or modify it under
 
21
# the terms of the GNU General Public License as published by the Free
 
22
# Software Foundation; either version 2 of the License, or (at your option)
 
23
# any later version.
 
24
 
25
# SLURM is distributed in the hope that it will be useful, but WITHOUT ANY
 
26
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 
27
# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 
28
# details.
 
29
 
30
# You should have received a copy of the GNU General Public License along
 
31
# with SLURM; if not, write to the Free Software Foundation, Inc.,
 
32
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 
33
############################################################################
 
34
source ./globals_accounting
 
35
 
 
36
set test_id     "test21.26"
 
37
set exit_code   0
 
38
set cluster1            qclustest
 
39
set account1            qacctest1
 
40
set account2            qacctest2
 
41
set qos1                qqostest
 
42
set user1               qusertest
 
43
set access_err  0
 
44
 
 
45
print_header $test_id
 
46
 
 
47
set timeout 60
 
48
 
 
49
#
 
50
# Check accounting config and bail if not found
 
51
#
 
52
if { [test_account_storage] == 0 } {
 
53
        send_user "\nWARNING: This test can't be run without a usable AccountStorageType\n"
 
54
        exit 0
 
55
}
 
56
 
 
57
#
 
58
#make sure we have permission to do this work
 
59
#
 
60
if { [string compare [check_accounting_admin_level] "Administrator"] } {
 
61
        send_user "\nWARNING: This test can't be run without being an Accounting administrator.\nUse sacctmgr mod user \$USER_NAME admin=admin.\n"
 
62
        exit 0
 
63
}
 
64
 
 
65
#
 
66
# remove test associations to make sure we have a clean system
 
67
#
 
68
remove_user "" "" "$user1"
 
69
remove_acct "" "$account1,$account2"
 
70
remove_qos "$qos1"
 
71
remove_cluster "$cluster1"
 
72
if {$access_err != 0} {
 
73
        send_user "\nWARNING: not authorized to perform this test\n"
 
74
        exit $exit_code
 
75
}
 
76
 
 
77
# Build test associations
 
78
#=====Done Cleaning System=========Begin Add Cluster======
 
79
#add cluster
 
80
incr exit_code [add_cluster "$cluster1" " " "" "" "" "" "" "" "" "" "" "" ""]
 
81
if { $exit_code } {
 
82
        remove_user "" "" "$user1"
 
83
        remove_acct "" "$account1,$account2"
 
84
        remove_qos "$qos1"
 
85
        remove_cluster "$cluster1"
 
86
        exit $exit_code
 
87
}
 
88
#=====Done Add Cluster========Begin Add QoS==========
 
89
#add qos
 
90
incr exit_code [add_qos "$qos1"]
 
91
if { $exit_code } {
 
92
        remove_user "" "" "$user1"
 
93
        remove_acct "" "$account1,$account2"
 
94
        remove_qos "$qos1"
 
95
        remove_cluster "$cluster1"
 
96
        exit $exit_code
 
97
}
 
98
#====Done Add QoS===========Begin Add First Account========
 
99
#add default account
 
100
incr exit_code [add_acct "$cluster1" "" "$account1" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""]
 
101
if { $exit_code } {
 
102
        remove_user "" "" "$user1"
 
103
        remove_acct "" "$account1,$account2"
 
104
        remove_qos "$qos1"
 
105
        remove_cluster "$cluster1"
 
106
        exit $exit_code
 
107
}
 
108
#====Done Add First Account====Begin Add Second Account====
 
109
#add account
 
110
incr exit_code [add_acct "$cluster1" "$account1" "$account2" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""]
 
111
if { $exit_code } {
 
112
        remove_user "" "" "$user1"
 
113
        remove_acct "" "$account1,$account2"
 
114
        remove_qos "$qos1"
 
115
        remove_cluster "$cluster1"
 
116
        exit $exit_code
 
117
}
 
118
#=====Done Add Second Account========Begin Add User=========
 
119
#add user
 
120
incr exit_code [add_user "$cluster1" "$account1,$account2" "$user1" "" "" "$account1" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""]
 
121
if { $exit_code } {
 
122
        remove_user "" "" "$user1"
 
123
        remove_acct "" "$account1,$account2"
 
124
        remove_qos "$qos1"
 
125
        remove_cluster "$cluster1"
 
126
        exit $exit_code
 
127
}
 
128
#====Done add user====Done building test associations===Begin test section=======
 
129
 
 
130
#======Verify initial associations=============
 
131
set matches 0
 
132
set my_pid [eval spawn $sacctmgr list assoc cluster=$cluster1 format=qos,acct,user -p]
 
133
expect {
 
134
        -re "There was a problem" {
 
135
                send_user "FAILURE: there was a problem with the sacctmgr command\n"
 
136
                exit 1
 
137
        }
 
138
        -re "\n.root.(|root)." {
 
139
                incr matches
 
140
                exp_continue
 
141
        }
 
142
        -re "\n.$account1.(|$user1)." {
 
143
                incr matches
 
144
                exp_continue
 
145
        }
 
146
        -re "\n.$account2.(|$user1)." {
 
147
                incr matches
 
148
                exp_continue
 
149
        }
 
150
        timeout {
 
151
                send_user "\nFAILURE: sacctmgr list associations not responding\n"
 
152
                slow_kill $my_pid
 
153
                exit 1
 
154
        }
 
155
        eof {
 
156
                wait
 
157
        }
 
158
}
 
159
 
 
160
if {$matches != 6} {
 
161
        send_user "\nFAILURE: Initial sacctmgr add failed with ($matches)\n"
 
162
        remove_user "" "" "$user1"
 
163
        remove_acct "" "$account1,$account2"
 
164
        remove_qos "$qos1"
 
165
        remove_cluster "$cluster1"
 
166
        exit 1
 
167
}
 
168
 
 
169
#======Begin Modification to Add $qos1 to $account1=======
 
170
#modify test1 account to add test QoS
 
171
incr exit_code [mod_acct "$cluster1" "" "$account1" "" "" "+$qos1" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""]
 
172
if { $exit_code } {
 
173
        remove_user "" "" "$user1"
 
174
        remove_acct "" "$account1,$account2"
 
175
        remove_qos "$qos1"
 
176
        remove_cluster "$cluster1"
 
177
        exit $exit_code
 
178
}
 
179
 
 
180
#=======Done Modifying Account=======Next is Verify=======
 
181
set matches 0
 
182
set my_pid [eval spawn $sacctmgr list assoc cluster=$cluster1 format=qos,acct,user -p]
 
183
 
 
184
expect {
 
185
        -re "There was a problem" {
 
186
                send_user "FAILURE: there was a problem with the sacctmgr command\n"
 
187
                exit 1
 
188
        }
 
189
        -re "\n.root.(|root)." {
 
190
                incr matches
 
191
                exp_continue
 
192
        }
 
193
        -re "$qos1.$account1.(|$user1)." {
 
194
                incr matches
 
195
                exp_continue
 
196
        }
 
197
        -re "$qos1.$account2.(|$user1)." {
 
198
                incr matches
 
199
                exp_continue
 
200
        }
 
201
        timeout {
 
202
                send_user "\nFAILURE: sacctmgr list associations not responding\n"
 
203
                slow_kill $my_pid
 
204
                exit 1
 
205
        }
 
206
        eof {
 
207
                wait
 
208
        }
 
209
}
 
210
 
 
211
if {$matches != 6} {
 
212
        send_user "\nFAILURE: failed on verify of +$qos1 to account $account1 ($matches)\n"
 
213
        remove_user "" "" "$user1"
 
214
        remove_acct "" "$account1,$account2"
 
215
        remove_qos "$qos1"
 
216
        remove_cluster "$cluster1"
 
217
        exit 1
 
218
}
 
219
 
 
220
#======Begin Modification to Subtract $qos1 from $account2=======
 
221
#modify test2 account to remove test QoS
 
222
incr exit_code [mod_acct "$cluster1" "" "$account2" "" "" "-$qos1" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""]
 
223
if { $exit_code } {
 
224
        remove_user "" "" "$user1"
 
225
        remove_acct "" "$account1,$account2"
 
226
        remove_qos "$qos1"
 
227
        remove_cluster "$cluster1"
 
228
        exit $exit_code
 
229
}
 
230
 
 
231
#=======Done Modifying Account=======Next is Verify=======
 
232
set matches 0
 
233
set my_pid [eval spawn $sacctmgr list assoc cluster=$cluster1 format=qos,acct,user -p]
 
234
expect {
 
235
        -re "There was a problem" {
 
236
                send_user "FAILURE: there was a problem with the sacctmgr command\n"
 
237
                exit 1
 
238
        }
 
239
        -re "\n.root.(|root)." {
 
240
                incr matches
 
241
                exp_continue
 
242
        }
 
243
        -re "$qos1.$account1.(|$user1)." {
 
244
                incr matches
 
245
                exp_continue
 
246
        }
 
247
        -re "\n.$account2.(|$user1)." {
 
248
                incr matches
 
249
                exp_continue
 
250
        }
 
251
        timeout {
 
252
                send_user "\nFAILURE: sacctmgr list associations not responding\n"
 
253
                slow_kill $my_pid
 
254
                exit 1
 
255
        }
 
256
        eof {
 
257
                wait
 
258
        }
 
259
}
 
260
 
 
261
if {$matches != 6} {
 
262
        send_user "\nFAILURE: verify of -$qos1 from account $account2 ($matches)\n"
 
263
        remove_user "" "" "$user1"
 
264
        remove_acct "" "$account1,$account2"
 
265
        remove_qos "$qos1"
 
266
        remove_cluster "$cluster1"
 
267
        exit 1
 
268
}
 
269
 
 
270
 
 
271
#======Begin Modification to Subtract $qos1 from $account1=======
 
272
#modify test1 account to remove test QoS
 
273
incr exit_code [mod_acct "$cluster1" "" "$account1" "" "" "-$qos1" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""]
 
274
if { $exit_code } {
 
275
        remove_user "" "" "$user1"
 
276
        remove_acct "" "$account1,$account2"
 
277
        remove_qos "$qos1"
 
278
        remove_cluster "$cluster1"
 
279
        exit $exit_code
 
280
}
 
281
 
 
282
#=======Done Modifying Account=======Next is Verify=======
 
283
set matches 0
 
284
set my_pid [eval spawn $sacctmgr list assoc cluster=$cluster1 format=qos,acct,user -p]
 
285
expect {
 
286
        -re "There was a problem" {
 
287
                send_user "FAILURE: there was a problem with the sacctmgr command\n"
 
288
                exit 1
 
289
        }
 
290
        -re "\n.root.(|root)." {
 
291
                incr matches
 
292
                exp_continue
 
293
        }
 
294
        -re "\n.$account1.(|$user1)." {
 
295
                incr matches
 
296
                exp_continue
 
297
        }
 
298
        -re "\n.$account2.(|$user1)." {
 
299
                incr matches
 
300
                exp_continue
 
301
        }
 
302
        timeout {
 
303
                send_user "\nFAILURE: sacctmgr list associations not responding\n"
 
304
                slow_kill $my_pid
 
305
                exit 1
 
306
        }
 
307
        eof {
 
308
                wait
 
309
        }
 
310
}
 
311
 
 
312
if {$matches != 6} {
 
313
        send_user "\nFAILURE: verify of -$qos1 from account $account1 ($matches)\n"
 
314
        remove_user "" "" "$user1"
 
315
        remove_acct "" "$account1,$account2"
 
316
        remove_qos "$qos1"
 
317
        remove_cluster "$cluster1"
 
318
        exit 1
 
319
}
 
320
 
 
321
#=====Begin Modification to Add $qos1 from $account2=======
 
322
#modify test2 account to add test QoS
 
323
incr exit_code [mod_acct "$cluster1" "" "$account2" "" "" "+$qos1" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""]
 
324
if { $exit_code } {
 
325
        remove_user "" "" "$user1"
 
326
        remove_acct "" "$account1,$account2"
 
327
        remove_qos "$qos1"
 
328
        remove_cluster "$cluster1"
 
329
        exit $exit_code
 
330
}
 
331
 
 
332
#=======Done Modifying Account=======Next is Verify=======
 
333
set matches 0
 
334
set my_pid [eval spawn $sacctmgr list assoc cluster=$cluster1 format=qos,acct,user -p]
 
335
 
 
336
expect {
 
337
        -re "There was a problem" {
 
338
                send_user "FAILURE: there was a problem with the sacctmgr command\n"
 
339
                exit 1
 
340
        }
 
341
        -re "\n.root.(|root)." {
 
342
                incr matches
 
343
                exp_continue
 
344
        }
 
345
        -re "\n.$account1.(|$user1)." {
 
346
                incr matches
 
347
                exp_continue
 
348
        }
 
349
        -re "$qos1.$account2.(|$user1)." {
 
350
                incr matches
 
351
                exp_continue
 
352
        }
 
353
        timeout {
 
354
                send_user "\nFAILURE: sacctmgr list associations not responding\n"
 
355
                slow_kill $my_pid
 
356
                exit 1
 
357
        }
 
358
        eof {
 
359
                wait
 
360
        }
 
361
}
 
362
 
 
363
if {$matches != 6} {
 
364
        send_user "\nFAILURE: failed on verify of +$qos1 to account $account2 ($matches)\n"
 
365
        remove_user "" "" "$user1"
 
366
        remove_acct "" "$account1,$account2"
 
367
        remove_qos "$qos1"
 
368
        remove_cluster "$cluster1"
 
369
        exit 1
 
370
}
 
371
 
 
372
#=======Begin Modification to Add $qos1 from $account2=======
 
373
#modify root account to add test QoS
 
374
incr exit_code [mod_acct "$cluster1" "" "root" "" "" "+$qos1" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""]
 
375
if { $exit_code } {
 
376
        remove_user "" "" "$user1"
 
377
        remove_acct "" "$account1,$account2"
 
378
        remove_qos "$qos1"
 
379
        remove_cluster "$cluster1"
 
380
        exit $exit_code
 
381
}
 
382
 
 
383
#=======Done Modifying Account=======Next Is Verify=======
 
384
set matches 0
 
385
set my_pid [eval spawn $sacctmgr list assoc cluster=$cluster1 format=qos,acct,user -p]
 
386
 
 
387
expect {
 
388
        -re "There was a problem" {
 
389
                send_user "FAILURE: there was a problem with the sacctmgr command\n"
 
390
                exit 1
 
391
        }
 
392
        -re "$qos1.root.(|root)." {
 
393
                incr matches
 
394
                exp_continue
 
395
        }
 
396
        -re "\n.$account1.(|$user1)." {
 
397
                incr matches
 
398
                exp_continue
 
399
        }
 
400
        -re "$qos1.$account2.(|$user1)." {
 
401
                incr matches
 
402
                exp_continue
 
403
        }
 
404
        timeout {
 
405
                send_user "\nFAILURE: sacctmgr list associations not responding\n"
 
406
                slow_kill $my_pid
 
407
                exit 1
 
408
        }
 
409
        eof {
 
410
                wait
 
411
        }
 
412
}
 
413
 
 
414
if {$matches != 6} {
 
415
        send_user "\nFAILURE: failed on verify of +$qos1 to account root ($matches)\n"
 
416
        remove_user "" "" "$user1"
 
417
        remove_acct "" "$account1,$account2"
 
418
        remove_qos "$qos1"
 
419
        remove_cluster "$cluster1"
 
420
        exit 1
 
421
}
 
422
 
 
423
#======Begin Modification to Add $qos1 from $account2=======
 
424
#modify test2 account to remove test QoS
 
425
incr exit_code [mod_acct "$cluster1" "" "$account2" "" "" "-$qos1" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""]
 
426
if { $exit_code } {
 
427
        remove_user "" "" "$user1"
 
428
        remove_acct "" "$account1,$account2"
 
429
        remove_qos "$qos1"
 
430
        remove_cluster "$cluster1"
 
431
        exit $exit_code
 
432
}
 
433
 
 
434
#=======Done Modifying Account=======Next is Verify=======
 
435
set matches 0
 
436
set my_pid [eval spawn $sacctmgr list assoc cluster=$cluster1 format=qos,acct,user -p]
 
437
 
 
438
expect {
 
439
        -re "There was a problem" {
 
440
                send_user "FAILURE: there was a problem with the sacctmgr command\n"
 
441
                exit 1
 
442
        }
 
443
        -re "$qos1.root.(|root)." {
 
444
                incr matches
 
445
                exp_continue
 
446
        }
 
447
        -re "\n.$account1.(|$user1)." {
 
448
                incr matches
 
449
                exp_continue
 
450
        }
 
451
        -re "\n.$account2.(|$user1)." {
 
452
                incr matches
 
453
                exp_continue
 
454
        }
 
455
        timeout {
 
456
                send_user "\nFAILURE: sacctmgr list associations not responding\n"
 
457
                slow_kill $my_pid
 
458
                exit 1
 
459
        }
 
460
        eof {
 
461
                wait
 
462
        }
 
463
}
 
464
 
 
465
if {$matches != 6} {
 
466
        send_user "\nFAILURE: failed on verify of -$qos1 to account $account2 ($matches)\n"
 
467
        remove_user "" "" "$user1"
 
468
        remove_acct "" "$account1,$account2"
 
469
        remove_qos "$qos1"
 
470
        remove_cluster "$cluster1"
 
471
        exit 1
 
472
}
 
473
 
 
474
 
 
475
#======Done With List====== Ending=======
 
476
# This is the end below here
 
477
#
 
478
incr exit_code [remove_user "" "" "$user1"]
 
479
incr exit_code [remove_acct "" "$account1,$account2"]
 
480
incr exit_code [remove_qos "$qos1"]
 
481
incr exit_code [remove_cluster "$cluster1"]
 
482
 
 
483
if {$exit_code == 0} {
 
484
        send_user "\nSUCCESS: $test_id\n"
 
485
} else {
 
486
        send_user "\nFAILURE: $test_id\n"
 
487
}
 
488
exit $exit_code
 
489