2
############################################################################
3
# Purpose: Test of SLURM sshare functionality
4
# sshare h, p, P, v and V options.
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.
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.
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)
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
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
############################################################################
41
# Check accounting config and bail if not found.
43
if { [test_account_storage] == 0 } {
44
send_user "\nWARNING: This test can't be run without a usable AccountStorageType\n"
48
################################################################
52
# Purpose: Pass sshare options and test
54
# Returns: Number of matches.
56
# Input: Switch options not requiring arguments
58
################################################################
60
proc sshare_opt { soption } {
66
send_user "$sshare -$soption \n"
68
if { $soption == "-help"|| $soption == "-usage" } {
70
spawn $sshare -$soption
72
-re "SLURM accounting storage is disabled" {
76
-re "You are not running a supported priority plugin" {
80
-re "Usage: *sshare *.OPTION" {
81
if {$debug} {send_user "\nmatch1\n"}
85
-re "Valid OPTIONs are" {
86
if {$debug} {send_user "\nmatch2\n"}
90
-re "verbose *display more information" {
91
if {$debug} {send_user "\nmatch3\n"}
96
send_user "\nFAILURE: sshare not responding\n"
104
if {$not_support == 1} {
105
send_user "\nWARNING: can not test without accounting enabled\n"
109
if {$not_support == 2} {
110
send_user "\nWARNING: can not test without priority/multifactor plugin\n"
115
send_user "\nFAILURE: sshare -$soption failed ($matches)\n"
121
if { $soption == "-noheader" || $soption == "h" } {
123
spawn $sshare -$soption
125
-re "SLURM accounting storage is disabled" {
129
-re "You are not running a supported priority plugin" {
133
-re "Account|User|Raw Shares|Norm Shares|Raw Usage|Norm Usage|Effectv Usage" {
134
if {$debug} {send_user "\nmatch4\n"}
139
send_user "\nFAILURE: sshare not responding\n"
147
if {$not_support == 1} {
148
send_user "\nWARNING: can not test without accounting enabled\n"
152
if {$not_support == 2} {
153
send_user "\nWARNING: can not test without priority/multifactor plugin\n"
158
send_user "\nFAILURE: sshare -$soption failed ($matches)\n"
164
if { $soption == "-parsable" || $soption == "p" } {
166
spawn $sshare -$soption
168
-re "SLURM accounting storage is disabled" {
172
-re "You are not running a supported priority plugin" {
176
-re "Account\\|User\\|Raw Shares\\|Norm Shares\\|" {
177
if {$debug} {send_user "\nmatch5\n"}
181
-re "Raw Usage\\|Effectv Usage\\|Fair-share\\|" {
182
if {$debug} {send_user "\nmatch5\n"}
187
send_user "\nFAILURE: sshare not responding\n"
195
if {$not_support != 0} {
196
send_user "\nWARNING: can not test without accounting enabled\n"
200
send_user "\nFAILURE: sshare -$soption failed ($matches)\n"
206
if { $soption == "-parsable2" || $soption == "P" } {
208
spawn $sshare -$soption
210
-re "SLURM accounting storage is disabled" {
214
-re "You are not running a supported priority plugin" {
218
-re "Account\\|User\\|Raw Shares\\|Norm Shares\\|" {
219
if {$debug} {send_user "\nmatch6\n"}
223
-re "Raw Usage\\|Effectv Usage\\|Fair-share" {
224
if {$debug} {send_user "\nmatch7\n"}
229
send_user "\nFAILURE: sshare not responding\n"
237
if {$not_support == 1} {
238
send_user "\nWARNING: can not test without accounting enabled\n"
242
if {$not_support == 2} {
243
send_user "\nWARNING: can not test without priority/multifactor plugin\n"
248
send_user "\nFAILURE: sshare -$soption failed ($matches)\n"
254
if { $soption == "-verbose" || $soption == "v" } {
256
spawn $sshare -$soption
258
-re "SLURM accounting storage is disabled" {
262
-re "You are not running a supported priority plugin" {
266
-re "Users requested" {
267
if {$debug} {send_user "\nmatch8\n"}
271
-re "Accounts requested" {
272
if {$debug} {send_user "\nmatch9\n"}
276
-re "sshare: .* loaded" {
277
if {$debug} {send_user "\nmatch10\n"}
282
send_user "\nFAILURE: sshare not responding\n"
290
if {$not_support == 1} {
291
send_user "\nWARNING: can not test without accounting enabled\n"
295
if {$not_support == 2} {
296
send_user "\nWARNING: can not test without priority/multifactor plugin\n"
301
send_user "\nFAILURE: sshare -$soption failed ($matches)\n"
308
if { $soption == "-version" || $soption == "V" } {
310
spawn $sshare -$soption
312
-re "SLURM accounting storage is disabled" {
316
-re "You are not running a supported priority plugin" {
320
-re "slurm $number.$number.$number" {
321
if {$debug} {send_user "\nmatch11\n"}
326
send_user "\nFAILURE: sshare not responding\n"
334
if {$not_support == 1} {
335
send_user "\nWARNING: can not test without accounting enabled\n"
339
if {$not_support == 2} {
340
send_user "\nWARNING: can not test without priority/multifactor plugin\n"
345
send_user "\nFAILURE: sshare -$soption failed ($matches)\n"
352
################################################################
354
set matches [sshare_opt -help ]
356
send_user "\nFAILURE: sshare --help failed ($matches)\n"
360
set matches [sshare_opt -usage ]
362
send_user "\nFAILURE: sshare --usage failed ($matches)\n"
366
set matches [sshare_opt h ]
368
send_user "\nFAILURE: sshare -n failed ($matches)\n"
372
set matches [sshare_opt -noheader ]
374
send_user "\nFAILURE: sshare --noheader failed ($matches)\n"
378
set matches [sshare_opt p ]
380
send_user "\nFAILURE: sshare -p failed ($matches)\n"
384
set matches [sshare_opt -parsable ]
386
send_user "\nFAILURE: sshare --parsable failed ($matches)\n"
390
set matches [sshare_opt P ]
392
send_user "\nFAILURE: sshare -P failed ($matches)\n"
396
set matches [sshare_opt -parsable2 ]
398
send_user "\nFAILURE: sshare --parsable2 failed ($matches)\n"
402
set matches [sshare_opt v ]
404
send_user "\nFAILURE: sshare -v failed ($matches)\n"
408
set matches [sshare_opt -verbose ]
410
send_user "\nFAILURE: sshare --verbose failed ($matches)\n"
415
set matches [sshare_opt V ]
417
send_user "\nFAILURE: sshare -v failed ($matches)\n"
421
set matches [sshare_opt -version ]
423
send_user "\nFAILURE: sshare --verbose failed ($matches)\n"
427
if {$exit_code == 0} {
428
send_user "\nSUCCESS\n"