From ef2cf714032a53d3b705e4fc98f167aa123a1a03 Mon Sep 17 00:00:00 2001 From: "Christopher J. Morrone" <morrone2@llnl.gov> Date: Thu, 1 Dec 2005 23:51:59 +0000 Subject: [PATCH] Rewrite of test13.1 to make it work more like intended. --- testsuite/expect/globals.example | 3 ++ testsuite/expect/test13.1 | 57 +++++++++++++++----------------- 2 files changed, 29 insertions(+), 31 deletions(-) diff --git a/testsuite/expect/globals.example b/testsuite/expect/globals.example index 8b6b43ed06e..bdd66ecbc51 100755 --- a/testsuite/expect/globals.example +++ b/testsuite/expect/globals.example @@ -51,6 +51,9 @@ set poe "/usr/bin/poe" set mpirun "mpirun" set totalviewcli "/usr/local/bin/totalviewcli" +# Pattern to match your shell prompt +set prompt "(%|#|\\\$) $" + # # Specify locations of other executable files used # Only the shell names (e.g. bin_bash) must be full pathnames diff --git a/testsuite/expect/test13.1 b/testsuite/expect/test13.1 index f9370e78c7c..48ea98fa162 100755 --- a/testsuite/expect/test13.1 +++ b/testsuite/expect/test13.1 @@ -36,25 +36,10 @@ set exit_code 0 print_header $test_id -# Execute srun processes within an existing allocation -# We go through 2049 (32*64+1) switch contexts here -# Return 0 on successful completion, returns 1 otherwise -proc run_tasks { } { - global srun bin_sleep bin_usleep - set delay 10 - send "$srun -N1 $bin_sleep $delay &\n" - for {set inx 0} {$inx < 50} {incr inx} { - exec $bin_usleep 1000 - send "$srun -N1 -O -n32 true\n" - } - send "$bin_sleep $delay\n" - return 0 -} - # # Report the slurm configuration # -set matches 0 +set matches 0 log_user 0 spawn $scontrol show config expect { @@ -77,34 +62,44 @@ if {$matches != 1} { } # -# Submit a slurm allocate job -# Interactively print $SLURM_JOBID -# Then run a bunch of job steps within that allocation +# Submit a slurm allocate job, then run a bunch of job +# steps within that allocation # 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 "$bin_echo MY_ID=\$SLURM_JOBID \n" - exp_continue - } - -re "MY_ID=($number)" { - if {[run_tasks]} { + +expect -re "jobid ($number).*" +set job_id $expect_out(1,string) +#send_user "SLURM_JOBID is $job_id\n" + +expect -re $prompt + +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 } - send "exit\n" - exp_continue + -re $prompt {} } +} + +send "exit\n" + +expect { -re "error" { send_user "\nFAILURE: some error occurred\n" set exit_code 1 - exp_continue } timeout { - send_user "\nFAILURE: srun not responding\n" + send_user "\nFAILURE: srun (from --allocate) not responding\n" kill_srun set exit_code 1 exp_continue -- GitLab