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

Add debug code and test for usage option.

parent 64ca3ead
No related branches found
No related tags found
No related merge requests found
......@@ -532,6 +532,6 @@ test22.1 sreport cluster utilization report
test23.# Testing of sstat commands and options.
=================================================
test23.1 sstat -e, h, and V options
test23.1 sstat -e, h, usage and V options
test23.2 sstat --helpformat
test23.3 sstat -a, n, o, p, P, v options
#!/usr/bin/expect
############################################################################
# Purpose: Test of SLURM functionality
# Test sstat h, e, and V options.
# Test sstat h, e, usage and V options.
#
# Output: "TEST: #.#" followed by "SUCCESS" if test was successful, OR
# "FAILURE: ..." otherwise with an explanation of the failure, OR
......@@ -52,109 +52,164 @@ print_header $test_id
proc sstat_job { soption } {
global sstat
set exit_code 0
set matches 0
set not_support 0
set debug 0
set exit_code 0
set matches 0
set not_support 0
send_user "sstat -$soption \n"
if { $soption == "e" || $soption == "-helpformat" } {
if { $soption == "h" || $soption == "-help" } {
spawn $sstat -$soption
expect {
-re "sstat...OPTION" {
incr matches
exp_continue
spawn $sstat -$soption
expect {
-re "AveCPU *AvePages *AveRSS *AveVMSize" {
if {$debug} {send_user "\nmatch1\n"}
incr matches
exp_continue
}
-re "JobID *MaxPages *MaxPagesNode *MaxPagesTask" {
if {$debug} {send_user "\nmatch2\n"}
incr matches
exp_continue
}
-re "MaxRSS *MaxRSSNode *MaxRSSTask *MaxVMSize" {
if {$debug} {send_user "\nmatch3\n"}
incr matches
exp_continue
}
-re "MaxVMSizeNode *MaxVMSizeTask *MinCPU *MinCPUNode" {
if {$debug} {send_user "\nmatch4\n"}
incr matches
exp_continue
}
-re "MinCPUTask *NTasks *SystemCPU *TotalCPU" {
if {$debug} {send_user "\nmatch5\n"}
incr matches
exp_continue
}
timeout {
send_user "\nFAILURE: sstat not responding\n"
set exit_code 1
}
eof {
wait
}
}
-re "Valid..OPTION" {
incr matches
exp_continue
}
-re "-e, --helpformat" {
incr matches
exp_continue
}
timeout {
send_user "\nFAILURE: sstat not responding\n"
if {$matches != 5} {
send_user "\nFAILURE: sstat -$soption failed ($matches)\n"
set exit_code 1
}
eof {
wait
return $matches
}
}
if {$matches != 3} {
send_user "\nFAILURE: sstat -$soption failed ($matches)\n"
set exit_code 1
}
return $matches
}
if { $soption == "h" || $soption == "-help" } {
if { $soption == "V" || $soption == "-version" } {
spawn $sstat -$soption
expect {
-re "slurm 1.4." {
incr matches
exp_continue
spawn $sstat -$soption
expect {
-re "sstat...OPTION" {
if {$debug} {send_user "\nmatch6\n"}
incr matches
exp_continue
}
-re "Valid..OPTION" {
if {$debug} {send_user "\nmatch7\n"}
incr matches
exp_continue
}
-re "-e, --helpformat" {
if {$debug} {send_user "\nmatch8\n"}
incr matches
exp_continue
}
timeout {
send_user "\nFAILURE: sstat not responding\n"
set exit_code 1
}
eof {
wait
}
}
timeout {
send_user "\nFAILURE: sstat not responding\n"
if {$matches != 3} {
send_user "\nFAILURE: sstat -$soption failed ($matches)\n"
set exit_code 1
}
eof {
wait
return $matches
}
}
if {$matches != 1} {
send_user "\nFAILURE: sstat -$soption failed ($matches)\n"
set exit_code 1
}
return $matches
}
if { $soption == "-usage" } {
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
spawn $sstat -$soption
expect {
-re "Usage: sstat .options. -j .job..stepid." {
if {$debug} {send_user "\nmatch9\n"}
incr matches
exp_continue
}
-re "Use --help for help" {
if {$debug} {send_user "\nmatch10\n"}
incr matches
exp_continue
}
timeout {
send_user "\nFAILURE: sstat not responding\n"
set exit_code 1
}
eof {
wait
}
}
-re "MaxRSS *MaxRSSNode *MaxRSSTask *MaxVMSize" {
incr matches
exp_continue
if {$matches != 2} {
send_user "\nFAILURE: sstat -$soption failed ($matches)\n"
set exit_code 1
}
-re "MaxVMSizeNode *MaxVMSizeTask *MinCPU *MinCPUNode" {
incr matches
exp_continue
return $matches
}
-re "MinCPUTask *NTasks *SystemCPU *TotalCPU" {
incr matches
exp_continue
if { $soption == "V" || $soption == "-version" } {
spawn $sstat -$soption
expect {
-re "slurm 1.4." {
if {$debug} {send_user "\nmatch11\n"}
incr matches
exp_continue
}
timeout {
send_user "\nFAILURE: sstat not responding\n"
set exit_code 1
}
eof {
wait
}
}
timeout {
send_user "\nFAILURE: sstat not responding\n"
if {$matches != 1} {
send_user "\nFAILURE: sstat -$soption failed ($matches)\n"
set exit_code 1
}
eof {
wait
return $matches
}
}
################################################################
set matches [sstat_job e ]
if {$matches != 5} {
send_user "\nFAILURE: sstat -$soption failed ($matches)\n"
send_user "\nFAILURE: sstat -e failed ($matches)\n"
set exit_code 1
} else {
send_user "\nsstat -e test GOOD!\n"
}
return $matches
}
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"
}
################################################################
set matches [sstat_job h ]
if {$matches != 3} {
......@@ -172,6 +227,14 @@ if {$matches != 3} {
send_user "\nsstat --help test GOOD!\n"
}
set matches [sstat_job -usage ]
if {$matches != 2} {
send_user "\nFAILURE: sstat --usage failed ($matches)\n"
set exit_code 1
} else {
send_user "\nsstat --usage test GOOD!\n"
}
set matches [sstat_job V ]
if {$matches != 1} {
send_user "\nFAILURE: sstat -V failed ($matches)\n"
......@@ -188,21 +251,7 @@ if {$matches != 1} {
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} {
send_user "\nSUCCESS\n"
......
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