From f3da95793275fa8322224e22ed2a54ea5aea4efa Mon Sep 17 00:00:00 2001
From: Moe Jette <jette1@llnl.gov>
Date: Fri, 9 Jul 2010 18:24:24 +0000
Subject: [PATCH] add test for gang scheduling mode and disable test3.7
 (suspend/resume) with gang scheduling

---
 testsuite/expect/globals | 31 ++++++++++++++++++++++++++++++-
 testsuite/expect/test3.7 |  4 ++++
 2 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/testsuite/expect/globals b/testsuite/expect/globals
index c5503feb0cd..e3ff7ff096c 100755
--- a/testsuite/expect/globals
+++ b/testsuite/expect/globals
@@ -656,7 +656,7 @@ proc test_assoc_enforced { } {
 #
 ################################################################
 proc test_limits_enforced { } {
-	global scontrol number
+	global scontrol
 
 	log_user 0
 	set enforced 0
@@ -675,6 +675,35 @@ proc test_limits_enforced { } {
 	return $enforced
 }
 
+################################################################
+#
+# Proc: test_gang
+#
+# Purpose: Determine if gang scheduling is configured
+#
+# Returns level of association enforcement, 0 if none
+#
+################################################################
+proc test_gang { } {
+	global scontrol
+
+	log_user 0
+	set gang 0
+	spawn $scontrol show config
+	expect {
+		-re "PreemptMode *= .*GANG" {
+			set gang 1
+			exp_continue
+		}
+		eof {
+			wait
+		}
+	}
+
+	log_user 1
+	return $gang
+}
+
 ################################################################
 #
 # Proc: test_power_save
diff --git a/testsuite/expect/test3.7 b/testsuite/expect/test3.7
index 292ef8d3157..bc452145c26 100755
--- a/testsuite/expect/test3.7
+++ b/testsuite/expect/test3.7
@@ -48,6 +48,10 @@ set not_supported  0
 
 print_header $test_id
 
+if {[test_gang] != 0} {
+	send_user "\nWARNING: This test can't be run with gang scheduling\n"
+	exit 0
+}
 if {[is_super_user] == 0} {
 	send_user "\nWARNING: This test can't be run except as SlurmUser\n"
 	exit 0
-- 
GitLab