From 703704f8c6568d28ef0456ec0cd5cc25a2faff9a Mon Sep 17 00:00:00 2001
From: Moe Jette <jette1@llnl.gov>
Date: Tue, 19 Sep 2006 20:41:21 +0000
Subject: [PATCH] Remove some more kill_srun calls

---
 testsuite/expect/test6.10 |  5 ++---
 testsuite/expect/test6.11 |  5 ++---
 testsuite/expect/test6.12 | 12 ++++++------
 testsuite/expect/test6.3  |  5 ++---
 testsuite/expect/test6.4  | 12 +++++-------
 testsuite/expect/test6.5  | 11 +++++------
 testsuite/expect/test6.7  |  5 ++---
 testsuite/expect/test6.8  | 10 ++++------
 testsuite/expect/test6.9  |  4 ++--
 testsuite/expect/test7.1  | 12 ++++++------
 testsuite/expect/test7.2  |  5 ++---
 11 files changed, 38 insertions(+), 48 deletions(-)

diff --git a/testsuite/expect/test6.10 b/testsuite/expect/test6.10
index c44ed04f2c3..1f1093cdaa7 100755
--- a/testsuite/expect/test6.10
+++ b/testsuite/expect/test6.10
@@ -73,7 +73,7 @@ make_bash_script $file_in "$srun $bin_sleep $max_job_delay"
 #
 # Spawn a srun batch job
 #
-spawn $srun --batch --output=/dev/null --error=/dev/null --hold -t5 $file_in
+set srun_pid [spawn $srun --batch --output=/dev/null --error=/dev/null --hold -t5 $file_in]
 expect {
 	-re "jobid ($number) submitted" {
 		set job_id $expect_out(1,string)
@@ -81,9 +81,8 @@ expect {
 	}
 	timeout {
 		send_user "\nFAILURE: srun not responding\n"
-		kill_srun
+		slow_kill $srun_pid
 		set exit_code 1
-		exp_continue
 	}
 	eof {
 		wait
diff --git a/testsuite/expect/test6.11 b/testsuite/expect/test6.11
index aa4d6d5642e..8e4b2b1fb61 100755
--- a/testsuite/expect/test6.11
+++ b/testsuite/expect/test6.11
@@ -41,7 +41,7 @@ print_header $test_id
 #
 # Submit a job so we have something to work with
 #
-spawn $srun --batch --output=/dev/null --error=/dev/null --hold -t1 $bin_id
+set srun_pid [spawn $srun --batch --output=/dev/null --error=/dev/null --hold -t1 $bin_id]
 expect {
 	-re "jobid ($number) submitted" {
 		set job_id $expect_out(1,string)
@@ -49,9 +49,8 @@ expect {
 	}
 	timeout {
 		send_user "\nFAILURE: srun not responding\n"
-		kill_srun
+		slow_kill $srun_pid
 		set exit_code 1
-		exp_continue
 	}
 	eof {
 		wait
diff --git a/testsuite/expect/test6.12 b/testsuite/expect/test6.12
index ad62230c8d1..c0df511ff52 100755
--- a/testsuite/expect/test6.12
+++ b/testsuite/expect/test6.12
@@ -76,7 +76,7 @@ done
 # Spawn a srun batch job with arguments
 #
 set timeout $max_job_delay
-spawn $srun --batch --output=$file_out --error=$file_err -t2 $file_in
+set srun_pid [spawn $srun --batch --output=$file_out --error=$file_err -t2 $file_in]
 expect {
 	-re "jobid ($number) submitted" {
 		set job_id $expect_out(1,string)
@@ -84,7 +84,7 @@ expect {
 	}
 	timeout {
 		send_user "\nFAILURE: srun not responding\n"
-		kill_srun
+		slow_kill $srun_pid
 		exit 1
 	}
 	eof {
@@ -158,7 +158,7 @@ file delete $file_out $file_err
 make_bash_script $file_in "$bin_sleep 500"
 
 set job_id 0
-spawn $srun --batch --output=$file_out --error=$file_err -t2 $file_in
+set srun_pid [spawn $srun --batch --output=$file_out --error=$file_err -t2 $file_in]
 expect {
 	-re "jobid ($number) submitted" {
 		set job_id $expect_out(1,string)
@@ -166,7 +166,7 @@ expect {
 	}
 	timeout {
 		send_user "\nFAILURE: srun not responding\n"
-		kill_srun
+		slow_kill $srun_pid
 		exit 1
 	}
 	eof {
@@ -236,7 +236,7 @@ set job_id      0
 file delete $file_out $file_err
 make_bash_script $file_in "$srun $bin_sleep 500"
 
-spawn $srun --batch --output=$file_out --error=$file_err -t2 $file_in
+set srun_pid [spawn $srun --batch --output=$file_out --error=$file_err -t2 $file_in]
 expect {
 	-re "jobid ($number) submitted" {
 		set job_id $expect_out(1,string)
@@ -244,7 +244,7 @@ expect {
 	}
 	timeout {
 		send_user "\nFAILURE: srun not responding\n"
-		kill_srun
+		slow_kill $srun_pid
 		exit 1
 	}
 	eof {
diff --git a/testsuite/expect/test6.3 b/testsuite/expect/test6.3
index b09fe384f20..e3e7e55b801 100755
--- a/testsuite/expect/test6.3
+++ b/testsuite/expect/test6.3
@@ -47,7 +47,7 @@ make_bash_script $file_in "$srun $bin_sleep 600"
 #
 # Submit a job so we have something to work with
 #
-spawn $srun --batch --output=/dev/null --error=/dev/null -t1 $file_in
+set srun_pid [spawn $srun --batch --output=/dev/null --error=/dev/null -t1 $file_in]
 expect {
 	-re "jobid ($number) submitted" {
 		set job_id1 $expect_out(1,string)
@@ -55,9 +55,8 @@ expect {
 	}
 	timeout {
 		send_user "\nFAILURE: srun not responding\n"
-		kill_srun
+		slow_kill $srun_pid
 		set exit_code 1
-		exp_continue
 	}
 	eof {
 		wait
diff --git a/testsuite/expect/test6.4 b/testsuite/expect/test6.4
index de9d5e1516f..5478571b0e8 100755
--- a/testsuite/expect/test6.4
+++ b/testsuite/expect/test6.4
@@ -47,7 +47,7 @@ make_bash_script $file_in "$srun $bin_sleep 10"
 #
 # Submit a couple of jobs so we have something to work with
 #
-spawn $srun --batch --output=/dev/null --error=/dev/null --job-name=job1 -t1 $file_in
+set srun_pid [spawn $srun --batch --output=/dev/null --error=/dev/null --job-name=job1 -t1 $file_in]
 expect {
 	-re "jobid ($number) submitted" {
 		set job_id1 $expect_out(1,string)
@@ -55,9 +55,8 @@ expect {
 	}
 	timeout {
 		send_user "\nFAILURE: srun not responding\n"
-		kill_srun
+		slow_kill $srun_pid
 		set exit_code 1
-		exp_continue
 	}
 	eof {
 		wait
@@ -68,7 +67,7 @@ if {$job_id1 == 0} {
 	exit 1
 }
 
-spawn $srun --batch --output=/dev/null --error=/dev/null --job-name=job2 -t1 $file_in
+set srun_pid [spawn $srun --batch --output=/dev/null --error=/dev/null --job-name=job2 -t1 $file_in]
 expect {
 	-re "jobid ($number) submitted" {
 		set job_id2 $expect_out(1,string)
@@ -76,17 +75,16 @@ expect {
 	}
 	timeout {
 		send_user "\nFAILURE: srun not responding\n"
-		kill_srun
+		slow_kill $srun_pid
 		set exit_code 1
-		exp_continue
 	}
 	eof {
 		wait
 	}
 }
 if {$job_id2 == 0} {
-	kill_srun
 	send_user "\nFAILURE: job submit failure\n"
+	cancel_job $job_id1
 	exit 1
 }
 exec $bin_rm -f $file_in
diff --git a/testsuite/expect/test6.5 b/testsuite/expect/test6.5
index e8d43b55c0a..b3bfaa77a94 100755
--- a/testsuite/expect/test6.5
+++ b/testsuite/expect/test6.5
@@ -49,7 +49,7 @@ make_bash_script $file_in "$srun $bin_sleep 10"
 # Submit a couple of jobs so we have something to work with
 #
 set timeout 10
-spawn $srun --batch --output=/dev/null --error=/dev/null -t1 $file_in
+set srun_pid [spawn $srun --batch --output=/dev/null --error=/dev/null -t1 $file_in]
 expect {
 	-re "jobid ($number) submitted" {
 		set job_id1 $expect_out(1,string)
@@ -57,7 +57,7 @@ expect {
 	}
 	timeout {
 		send_user "\nFAILURE: srun not responding\n"
-		kill_srun
+		slow_kill $srun_pid
 		exit 1
 	}
 	eof {
@@ -66,11 +66,10 @@ expect {
 }
 if {$job_id1 == 0} {
 	send_user "\nFAILURE: srun job initiation failure\n"
-	kill_srun
 	exit 1
 }
 
-spawn $srun --batch --output=/dev/null --error=/dev/null -t1 $file_in
+set srun_pid [spawn $srun --batch --output=/dev/null --error=/dev/null -t1 $file_in]
 expect {
 	-re "jobid ($number) submitted" {
 		set job_id2 $expect_out(1,string)
@@ -78,7 +77,7 @@ expect {
 	}
 	timeout {
 		send_user "\nFAILURE: srun not responding\n"
-		kill_srun
+		slow_kill $srun_pid
 		exit 1
 	}
 	eof {
@@ -87,7 +86,7 @@ expect {
 }
 if {$job_id2  == 0} {
 	send_user "\nFAILURE: srun job initiation failure\n"
-	kill_srun
+	cancel_job $job_id1
 	exit 1
 }
 exec $bin_rm -f $file_in
diff --git a/testsuite/expect/test6.7 b/testsuite/expect/test6.7
index 83e2219070a..1e9b1543a8e 100755
--- a/testsuite/expect/test6.7
+++ b/testsuite/expect/test6.7
@@ -47,7 +47,7 @@ make_bash_script $file_in "$srun $bin_sleep 10"
 #
 # Submit a job so we have something to work with
 #
-spawn $srun --batch --output=/dev/null --error=/dev/null -t1 $file_in
+set srun_pid [spawn $srun --batch --output=/dev/null --error=/dev/null -t1 $file_in]
 expect {
 	-re "jobid ($number) submitted" {
 		set job_id1 $expect_out(1,string)
@@ -55,9 +55,8 @@ expect {
 	}
 	timeout {
 		send_user "\nFAILURE: srun not responding\n"
-		kill_srun
+		slow_kill $srun_pid
 		set exit_code 1
-		exp_continue
 	}
 	eof {
 		wait
diff --git a/testsuite/expect/test6.8 b/testsuite/expect/test6.8
index 5d087e095a9..1920bff69e9 100755
--- a/testsuite/expect/test6.8
+++ b/testsuite/expect/test6.8
@@ -50,7 +50,7 @@ make_bash_script $file_in "$srun $bin_sleep $max_job_delay"
 #
 # Spawn a couple of srun batch jobs
 #
-spawn $srun --batch --output=/dev/null --error=/dev/null --job-name=job.$test_id --hold -t5 $file_in
+set srun_pid [spawn $srun --batch --output=/dev/null --error=/dev/null --job-name=job.$test_id --hold -t5 $file_in]
 expect {
 	-re "jobid ($number) submitted" {
 		set job_id1 $expect_out(1,string)
@@ -58,9 +58,8 @@ expect {
 	}
 	timeout {
 		send_user "\nFAILURE: srun not responding\n"
-		kill_srun
+		slow_kill $srun_pid
 		set exit_code 1
-		exp_continue
 	}
 	eof {
 		wait
@@ -71,7 +70,7 @@ if {$job_id1 == 0} {
 	exit 1
 }
 
-spawn $srun --batch --output=/dev/null --error=/dev/null --job-name=job.$test_id -t5 $file_in
+set srun_pid [spawn $srun --batch --output=/dev/null --error=/dev/null --job-name=job.$test_id -t5 $file_in]
 expect {
 	-re "jobid ($number) submitted" {
 		set job_id2 $expect_out(1,string)
@@ -79,9 +78,8 @@ expect {
 	}
 	timeout {
 		send_user "\nFAILURE: srun not responding\n"
-		kill_srun
+		slow_kill $srun_pid
 		set exit_code 1
-		exp_continue
 	}
 	eof {
 		wait
diff --git a/testsuite/expect/test6.9 b/testsuite/expect/test6.9
index 286a568c2b7..d92aecf946d 100755
--- a/testsuite/expect/test6.9
+++ b/testsuite/expect/test6.9
@@ -54,7 +54,7 @@ make_bash_script $file_in "
 #
 # Spawn srun batch job
 #
-spawn $srun --batch --output=/dev/null --error=/dev/null --job-name=job.$test_id -t5 $file_in
+set srun_pid [spawn $srun --batch --output=/dev/null --error=/dev/null --job-name=job.$test_id -t5 $file_in]
 expect {
 	-re "jobid ($number) submitted" {
 		set job_id $expect_out(1,string)
@@ -62,7 +62,7 @@ expect {
 	}
 	timeout {
 		send_user "\nFAILURE: srun not responding\n"
-		kill_srun
+		slow_kill $srun_pid
 		exit 1
 	}
 	eof {
diff --git a/testsuite/expect/test7.1 b/testsuite/expect/test7.1
index 2258024e1bd..077ef7c61fb 100755
--- a/testsuite/expect/test7.1
+++ b/testsuite/expect/test7.1
@@ -45,7 +45,7 @@ print_header $test_id
 #
 # Spawn three srun batch job, one held
 #
-spawn $srun --batch -t1 --output=/dev/null --error=/dev/null  $bin_pwd
+set srun_pid [spawn $srun --batch -t1 --output=/dev/null --error=/dev/null  $bin_pwd]
 expect {
 	-re "jobid ($number) submitted" {
 		set job_id1 $expect_out(1,string)
@@ -53,14 +53,14 @@ expect {
 	}
 	timeout {
 		send_user "\nFAILURE: srun not responding\n"
-		kill_srun
+		slow_kill $srun_pid
 		exit 1
 	}
 	eof {
 		wait
 	}
 }
-spawn $srun --batch -t1 --output=/dev/null --error=/dev/null $bin_pwd
+set srun_pid [spawn $srun --batch -t1 --output=/dev/null --error=/dev/null $bin_pwd]
 expect {
         -re "jobid ($number) submitted" {
                 set job_id2 $expect_out(1,string)
@@ -68,14 +68,14 @@ expect {
         }
         timeout {
                 send_user "\nFAILURE: srun not responding\n"
-                kill_srun
+                slow_kill $srun_pid
                 exit 1
         }
         eof {
 		wait
         }
 }
-spawn $srun --batch -t1 --output=/dev/null --error=/dev/null --hold $bin_pwd
+set srun_pid [spawn $srun --batch -t1 --output=/dev/null --error=/dev/null --hold $bin_pwd]
 expect {
         -re "jobid ($number) submitted" {
                 set job_id3 $expect_out(1,string)
@@ -83,7 +83,7 @@ expect {
         }
         timeout {
                 send_user "\nFAILURE: srun not responding\n"
-                kill_srun
+		slow_kill $srun_pid
                 exit 1
         }
         eof {
diff --git a/testsuite/expect/test7.2 b/testsuite/expect/test7.2
index d6f63616398..ad42f2a06cd 100755
--- a/testsuite/expect/test7.2
+++ b/testsuite/expect/test7.2
@@ -67,7 +67,7 @@ if { [test_bluegene] } {
 # Adjust time limits as needed for large task counts */
 #                   times are here  vv 
 set timeout [expr $max_job_delay +  60]
-spawn $srun -l -N$node_cnt -n8 -O -t1 --threads=1 $file_prog_get
+set srun_pid [spawn $srun -l -N$node_cnt -n8 -O -t1 --threads=1 $file_prog_get]
 expect {
 	-re "FAILURE" {
 		send_user "\nFAILURE: some error occured\n"
@@ -81,9 +81,8 @@ expect {
 	}
 	timeout {
 		send_user "\nFAILURE: srun not responding\n"
-		kill_srun
+		slow_kill $srun_pid
 		set exit_code 1
-		exp_continue
 	}
 	eof {
 		wait
-- 
GitLab