Skip to content
Snippets Groups Projects
Commit 095fb3ef authored by Moe Jette's avatar Moe Jette
Browse files

Fix code to test proper functionality and add a bunch more comments for clarity.

parent 58dd755e
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/expect
############################################################################
# Purpose: Test of SLURM functionality
# Test that elan switch contexts are not re-used.
# Test that switch windows in uses are not re-used.
#
# Output: "TEST: #.#" followed by "SUCCESS" if test was successful, OR
# "FAILURE: ..." otherwise with an explanation of the failure, OR
......@@ -37,14 +37,37 @@ set exit_code 0
print_header $test_id
#
# Report the slurm configuration
# Report the slurm network and use it to establish window parameters
#
# windows_per_node - switch windows available per node
# windows_interations - job steps to run after initial switch window allocation
# for a persistent job step
# windows_used - switch windows to use per job step
# step_delay - run time of persistent job step (seconds)
#
set matches 0
log_user 0
set step_delay 0
spawn $scontrol show config
expect {
-re "switch/((elan)|(none))" {
incr matches
-re "switch/elan" {
set windows_per_node 2048
set windows_interations 50
set windows_used 48
set step_delay 10
exp_continue
}
-re "switch/federation" {
set windows_per_node 16
set windows_interations 32
set windows_used 2
set step_delay 10
exp_continue
}
-re "switch/none" {
set windows_per_node 0
set windows_interations 5
set windows_used 4
set step_delay 5
exp_continue
}
timeout {
......@@ -56,8 +79,8 @@ expect {
}
}
log_user 1
if {$matches != 1} {
send_user "\nWARNING: not running elan switch, this test is not applicable\n"
if {$step_delay == 0} {
send_user "\nWARNING: not running compatable switch, this test is not applicable\n"
exit 0
}
......@@ -68,29 +91,21 @@ if {$matches != 1} {
set timeout $max_job_delay
set job_id 0
set matches 0
spawn $srun --allocate -N1 --verbose -t2
expect -re "jobid ($number).*"
set job_id $expect_out(1,string)
#send_user "SLURM_JOBID is $job_id\n"
expect -re $prompt
# start initial job step to claim some switch windows
send "$srun -N1 -O -n$windows_used $bin_sleep $step_delay &\n"
for {set inx 0} {$inx < 50} {incr inx} {
#sleep 0.001
send "$srun -N1 -O -n32 true\n"
expect {
-re "error" {
send_user "\nFAILURE: some error occurred\n"
set exit_code 1
exp_continue
}
-re $prompt {}
}
# start more job steps to check see if any switch window conflicts occur
for {set inx 0} {$inx < $windows_interations} {incr inx} {
#exec $bin_usleep 1000
send "$srun -N1 -O -n$windows_used true\n"
}
# wait for initial job step to complete
send "$bin_sleep $step_delay\n"
send "exit\n"
expect {
......
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