From 9d155873acc8648a5417fbdf1316b68d2490256d Mon Sep 17 00:00:00 2001
From: Moe Jette <jette1@llnl.gov>
Date: Wed, 16 Jul 2008 16:19:43 +0000
Subject: [PATCH] minor changes to support configurations with more than one
 partition

---
 testsuite/expect/test1.91 | 37 +++++++++++++++++++++++++++----------
 testsuite/expect/test5.6  |  2 +-
 2 files changed, 28 insertions(+), 11 deletions(-)

diff --git a/testsuite/expect/test1.91 b/testsuite/expect/test1.91
index f0a2669ffeb..256b0d4ba56 100755
--- a/testsuite/expect/test1.91
+++ b/testsuite/expect/test1.91
@@ -9,6 +9,7 @@
 #          anything else indicates a failure mode that must be investigated.
 ############################################################################
 # Copyright (C) 2005-2007 The Regents of the University of California.
+# Copyright (C) 2008 Lawrence Livermore National Security.
 # Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
 # Written by Morris Jette <jette1@llnl.gov>
 # LLNL-CODE-402394.
@@ -58,23 +59,39 @@ if {$affinity == 0} {
 	send_user "\nWARNING: task affinity not supported on this system\n"
 	exit 0
 }
+
 send_user "\ntask affinity plugin installed\n"
 
-set num_sockets 0
-set num_cores   0
-set num_threads 0
+# Identify a usable node
+set timeout $max_job_delay
 set node_name ""
-log_user 0
-
-# Here we need to get the last node since if we run this on heterogeneous
-# systems the count can change
-
-spawn $scontrol show node
+set srun_pid [spawn $srun -N1 --exclusive --verbose $bin_hostname]
 expect {
-	-re "NodeName=($alpha_numeric)" {
+	-re "on host ($alpha_numeric_under)" {
 		set node_name $expect_out(1,string)
 		exp_continue
 	}
+	timeout {
+		send_user "\nFAILURE: srun not responding\n"
+		slow_kill $srun_pid
+		set exit_code 1
+	}
+	eof {
+		wait
+	}
+}
+if {[string compare $node_name ""] == 0} {
+	send_user "\nFAILURE: failed to get a usable node name\n"
+	exit 1
+}
+
+# Determine how many sockets, cores, and threads the node has
+set num_sockets 0
+set num_cores   0
+set num_threads 0
+log_user 0
+spawn $scontrol show node $node_name
+expect {
 	-re "Sockets=($number)" {
 		set num_sockets $expect_out(1,string)
 		exp_continue
diff --git a/testsuite/expect/test5.6 b/testsuite/expect/test5.6
index b6b74ac737f..7d2879d346f 100755
--- a/testsuite/expect/test5.6
+++ b/testsuite/expect/test5.6
@@ -287,7 +287,7 @@ expect {
 		wait
 	}
 }
-if {[string compare partition2 ""]} {
+if {[string compare partition2 ""] == 0} {
 	set partition2 $partition1
 }
 spawn $squeue --format=%P --noheader --partitions=$partition1
-- 
GitLab