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

make test more correct (wait for prompt before sending next command)

from michal novotny
parent 0545484d
No related branches found
No related tags found
No related merge requests found
...@@ -36,7 +36,6 @@ source ./globals ...@@ -36,7 +36,6 @@ source ./globals
set test_id "15.23" set test_id "15.23"
set exit_code 0 set exit_code 0
set job_id 0 set job_id 0
set timeout $max_job_delay
print_header $test_id print_header $test_id
...@@ -51,6 +50,7 @@ set env(SALLOC_TIMELIMIT) 2 ...@@ -51,6 +50,7 @@ set env(SALLOC_TIMELIMIT) 2
# Spawn a job via salloc using these environment variables # Spawn a job via salloc using these environment variables
# #
set matches 0 set matches 0
set timeout $max_job_delay
set salloc_pid [spawn $salloc -N1 $bin_bash] set salloc_pid [spawn $salloc -N1 $bin_bash]
expect { expect {
-re "debug: Entering _msg_thr_internal" { -re "debug: Entering _msg_thr_internal" {
...@@ -59,10 +59,32 @@ expect { ...@@ -59,10 +59,32 @@ expect {
} }
-re "Granted job allocation ($number)" { -re "Granted job allocation ($number)" {
set job_id $expect_out(1,string) set job_id $expect_out(1,string)
send "$scontrol show job $job_id\r"
send "exit\r"
exp_continue exp_continue
} }
-re $prompt {
#send_user "Job initiated\n"
}
timeout {
send_user "\nFAILURE: srun not responding\n"
if {$job_id != 0} {
cancel_job $job_id
}
slow_kill [expr 0 - $salloc_pid]
set exit_code 1
}
eof {
wait
}
}
if {$job_id == 0} {
send_user "\nFAILURE: did not get job_id\n"
exit 1
}
set timeout 5
send "$scontrol show job $job_id\r"
expect {
-re "TimeLimit=($number):($number):" { -re "TimeLimit=($number):($number):" {
set time_limit [expr $expect_out(1,string) * 60 + $expect_out(2,string)] set time_limit [expr $expect_out(1,string) * 60 + $expect_out(2,string)]
if {$time_limit == 2} { if {$time_limit == 2} {
...@@ -73,6 +95,10 @@ expect { ...@@ -73,6 +95,10 @@ expect {
} }
exp_continue exp_continue
} }
-re $prompt {
send "exit\r"
exp_continue
}
timeout { timeout {
send_user "\nFAILURE: srun not responding\n" send_user "\nFAILURE: srun not responding\n"
if {$job_id != 0} { if {$job_id != 0} {
...@@ -86,10 +112,6 @@ expect { ...@@ -86,10 +112,6 @@ expect {
} }
} }
if {$job_id == 0} {
send_user "\nFAILURE: did not get job_id\n"
exit 1
}
if {$matches != 2} { if {$matches != 2} {
send_user "\nFAILURE: processed $matches of 2 environment variables\n" send_user "\nFAILURE: processed $matches of 2 environment variables\n"
set exit_code 1 set exit_code 1
......
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