Skip to content
Snippets Groups Projects
Commit ae9e3779 authored by Joseph P. Donaghy's avatar Joseph P. Donaghy
Browse files

Incorporated several option tests h, e, and V.

parent 9a8b4c66
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/expect
############################################################################
# Purpose: Test of SLURM functionality
# Test sstat --usage option. (initially same as --help)
# Test sstat h, e, and V options.
#
# Output: "TEST: #.#" followed by "SUCCESS" if test was successful, OR
# "FAILURE: ..." otherwise with an explanation of the failure, OR
# anything else indicates a failure mode that must be investigated.
############################################################################
# Copyright (C) 2008 Lawrence Livermore National Security.
# Copyright (C) 2008 - 2009 Lawrence Livermore National Security.
# Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
# Written by Joseph Donaghy <donaghy1@llnl.gov>
# LLNL-CODE-402394.
......@@ -38,11 +38,29 @@ set not_support 0
print_header $test_id
################################################################
#
# Report the sstat --help format
# Proc: sstat_job
#
# Purpose: Pass sstat option and test
#
# Returns: Number of matches.
#
# Input: sstat options not requiring arguments
#
################################################################
proc sstat_job { soption } {
global sstat
set exit_code 0
set matches 0
set not_support 0
send_user "sstat -$soption \n"
spawn $sstat --help
if { $soption == "h" || $soption == "-help" } {
spawn $sstat -$soption
expect {
-re "sstat...OPTION" {
incr matches
......@@ -65,9 +83,125 @@ expect {
}
}
if {$matches != 3} {
send_user "\nFAILURE: sstat -$soption failed ($matches)\n"
set exit_code 1
}
return $matches
}
if { $soption == "V" || $soption == "-version" } {
spawn $sstat -$soption
expect {
-re "slurm 1.4." {
incr matches
exp_continue
}
timeout {
send_user "\nFAILURE: sstat not responding\n"
set exit_code 1
}
eof {
wait
}
}
if {$matches != 1} {
send_user "\nFAILURE: sstat -$soption failed ($matches)\n"
set exit_code 1
}
return $matches
}
if { $soption == "e" || $soption == "-helpformat" } {
spawn $sstat -$soption
expect {
-re "AveCPU *AvePages *AveRSS *AveVMSize" {
incr matches
exp_continue
}
-re "JobID *MaxPages *MaxPagesNode *MaxPagesTask" {
incr matches
exp_continue
}
-re "MaxRSS *MaxRSSNode *MaxRSSTask *MaxVMSize" {
incr matches
exp_continue
}
-re "MaxVMSizeNode *MaxVMSizeTask *MinCPU *MinCPUNode" {
incr matches
exp_continue
}
-re "MinCPUTask *NTasks *SystemCPU *TotalCPU" {
incr matches
exp_continue
}
timeout {
send_user "\nFAILURE: sstat not responding\n"
set exit_code 1
}
eof {
wait
}
}
if {$matches != 5} {
send_user "\nFAILURE: sstat -$soption failed ($matches)\n"
set exit_code 1
}
return $matches
}
}
################################################################
set matches [sstat_job h ]
if {$matches != 3} {
send_user "\nFAILURE: sstat -h failed ($matches)\n"
set exit_code 1
} else {
send_user "\nsstat -h test GOOD!\n"
}
set matches [sstat_job -help ]
if {$matches != 3} {
send_user "\nFAILURE: sstat --help failed ($matches)\n"
set exit_code 1
} else {
send_user "\nsstat --help test GOOD!\n"
}
set matches [sstat_job V ]
if {$matches != 1} {
send_user "\nFAILURE: sstat -V failed ($matches)\n"
set exit_code 1
} else {
send_user "\nsstat -V test GOOD!\n"
}
set matches [sstat_job -version ]
if {$matches != 1} {
send_user "\nFAILURE: sstat --version failed ($matches)\n"
set exit_code 1
} else {
send_user "\nsstat --version test GOOD!\n"
}
set matches [sstat_job e ]
if {$matches != 5} {
send_user "\nFAILURE: sstat -e failed ($matches)\n"
set exit_code 1
} else {
send_user "\nsstat -e test GOOD!\n"
}
set matches [sstat_job -helpformat ]
if {$matches != 5} {
send_user "\nFAILURE: sstat --helpformat failed ($matches)\n"
set exit_code 1
} else {
send_user "\nsstat --helpformat test GOOD!\n"
}
if {$exit_code == 0} {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment