From 568d8e545e473ff9cf8e9713cc3d70b63ea2f712 Mon Sep 17 00:00:00 2001
From: Moe Jette <jette1@llnl.gov>
Date: Fri, 6 Mar 2009 19:00:53 +0000
Subject: [PATCH] make tests a bit more robust in the event that slurmctld is
 not responding

---
 testsuite/expect/globals  | 4 ++--
 testsuite/expect/test1.59 | 4 ++++
 testsuite/expect/test1.92 | 9 +++++++++
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/testsuite/expect/globals b/testsuite/expect/globals
index eb6dfb00164..b4de3de6b0e 100755
--- a/testsuite/expect/globals
+++ b/testsuite/expect/globals
@@ -714,7 +714,7 @@ proc priority_type {} {
 	catch {close $fd}
 
 	if {[string length $name] == 0} {
-		send_user "ERROR: could not identify the switch type"
+		send_user "ERROR: could not identify the switch type\n"
 	}
 
 	return $name
@@ -1099,7 +1099,7 @@ proc switch_type {} {
 	catch {close $fd}
 
 	if {[string length $name] == 0} {
-		send_user "ERROR: could not identify the switch type"
+		send_user "ERROR: could not identify the switch type\n"
 	}
 
 	return $name
diff --git a/testsuite/expect/test1.59 b/testsuite/expect/test1.59
index 912eab60d3d..0fcb5192c07 100755
--- a/testsuite/expect/test1.59
+++ b/testsuite/expect/test1.59
@@ -103,6 +103,10 @@ expect {
 		wait
 	}
 }
+if {$job_id == 0} {
+	send_user "\nFAILURE: salloc failure\n"
+	exit 1
+}
 
 for {set i 0} {$i<4} {incr i} {
 	set extra ""
diff --git a/testsuite/expect/test1.92 b/testsuite/expect/test1.92
index 460abfee186..3fa98121294 100755
--- a/testsuite/expect/test1.92
+++ b/testsuite/expect/test1.92
@@ -37,6 +37,7 @@ source ./globals
 set test_id     "1.92"
 set exit_code   0
 set file_bash   "test$test_id.bash"
+set job_id      0
 
 print_header $test_id
 
@@ -56,6 +57,10 @@ exit 0
 set timeout $max_job_delay
 set salloc_pid [spawn $salloc -N2 -n4 --verbose -t2 $bin_bash]
 expect {
+	-re "salloc: Granted job allocation ($number):" {
+		set job_id $expect_out(1,string)
+		exp_continue
+	}
 	-re "More processors requested than permitted" {
 		send_user "\nWARNING: can't test srun task distribution\n"
 		exit 0
@@ -73,6 +78,10 @@ expect {
 		exit 1
 	}
 }
+if {$job_id == 0} {
+	send_user "\nFAILURE: salloc failure\n"
+	exit 1
+}
 
 #############################################################################
 #
-- 
GitLab