From cb98a2a4fdb3e22c1d1da8de5ca0800484aca32e Mon Sep 17 00:00:00 2001
From: Danny Auble <da@schedmd.com>
Date: Tue, 29 Dec 2015 10:42:02 -0800
Subject: [PATCH] Disable certain tests if AccoutingStorageEnforce has either
 nosteps or nojobs.

---
 testsuite/expect/globals   | 37 +++++++++++++++++++++++++++++++++++++
 testsuite/expect/test1.75  |  5 +++++
 testsuite/expect/test12.2  |  5 +++++
 testsuite/expect/test12.7  |  5 +++++
 testsuite/expect/test12.8  |  5 +++++
 testsuite/expect/test14.10 |  5 +++++
 testsuite/expect/test14.6  |  5 +++++
 testsuite/expect/test7.13  |  5 +++++
 testsuite/expect/test7.9   |  5 +++++
 9 files changed, 77 insertions(+)

diff --git a/testsuite/expect/globals b/testsuite/expect/globals
index a9241fa1c87..e87cdb54bc1 100755
--- a/testsuite/expect/globals
+++ b/testsuite/expect/globals
@@ -3559,3 +3559,40 @@ proc available_nodes_hostnames { partition } {
 	log_user 1
 	return $idle_nodelist
 }
+
+#####################################################################
+#
+# Proc: test_accting_steps
+#
+# Purpose: Determine if nostep or nojobs is set for
+#          AccoutingStorageEnforce
+#
+# Returns: 1 if set else 0
+#
+#####################################################################
+
+proc test_accting_steps { } {
+
+	global scontrol alpha_numeric_comma
+	log_user 0
+	set enforce_limits 1
+	spawn $scontrol show config
+	expect {
+		-re "AccountingStorageEnforce *= ($alpha_numeric_comma)" {
+			if {[string first "nosteps" $expect_out(1,string)] != -1 } {
+				set enforce_limits 0
+			}
+			if {[string first "nojobs" $expect_out(1,string)] != -1 } {
+				set enforce_limits 0
+			}
+			exp_continue
+		}
+		eof {
+			wait
+		}
+
+	}
+	log_user 1
+
+	return $enforce_limits
+}
diff --git a/testsuite/expect/test1.75 b/testsuite/expect/test1.75
index 2b1203be2c2..29246e22256 100755
--- a/testsuite/expect/test1.75
+++ b/testsuite/expect/test1.75
@@ -73,6 +73,11 @@ if {[test_cpu_affinity_or_cgroup] == 0} {
 	send_user "\nWARNING: This test requires some form of task affinity\n"
 	exit 0
 }
+if {![test_accting_steps]} {
+	send_user "\nWARNING: This test can not be run with nosteps or nojobs "
+	send_user "(AccountingStorageEnforce)\n"
+	exit 0
+}
 
 proc sub_job { freq } {
 
diff --git a/testsuite/expect/test12.2 b/testsuite/expect/test12.2
index 429afbeb32b..13bd7e2d6b8 100755
--- a/testsuite/expect/test12.2
+++ b/testsuite/expect/test12.2
@@ -54,6 +54,11 @@ if {[test_front_end]} {
         send_user "\nWARNING: This test is incompatible with front-end systems\n"
         exit $exit_code
 }
+if {![test_accting_steps]} {
+	send_user "\nWARNING: This test can not be run with nosteps or nojobs "
+	send_user "(AccountingStorageEnforce)\n"
+	exit 0
+}
 
 if {[test_launch_poe]} {
 #	Allow extra time and memory for the POE process
diff --git a/testsuite/expect/test12.7 b/testsuite/expect/test12.7
index 10fd3e84e6c..c52aa674d07 100755
--- a/testsuite/expect/test12.7
+++ b/testsuite/expect/test12.7
@@ -39,6 +39,11 @@ set file_in    "test$test_id\_sc"
 
 print_header $test_id
 
+if {![test_accting_steps]} {
+	send_user "\nWARNING: This test can not be run with nosteps or nojobs "
+	send_user "(AccountingStorageEnforce)\n"
+	exit 0
+}
 if { [test_super_user] == 0 } {
 	send_user "WARNING: Test can only be run as SlurmUser\n"
 	exit $exit_code
diff --git a/testsuite/expect/test12.8 b/testsuite/expect/test12.8
index 0d650b9abe7..452c7d43861 100755
--- a/testsuite/expect/test12.8
+++ b/testsuite/expect/test12.8
@@ -38,6 +38,11 @@ set file_in       "test$test_id\_sc"
 
 print_header $test_id
 
+if {![test_accting_steps]} {
+	send_user "\nWARNING: This test can not be run with nosteps or nojobs "
+	send_user "(AccountingStorageEnforce)\n"
+	exit 0
+}
 if {[test_using_slurmdbd] == 0} {
 	send_user "\nWARNING: This test requires use of Slurmdbd\n"
 	exit $exit_code
diff --git a/testsuite/expect/test14.10 b/testsuite/expect/test14.10
index 36bb6da1666..b5e638f67d7 100755
--- a/testsuite/expect/test14.10
+++ b/testsuite/expect/test14.10
@@ -41,6 +41,11 @@ set node2      ""
 
 print_header $test_id
 
+if {![test_accting_steps]} {
+	send_user "\nWARNING: This test can not be run with nosteps or nojobs "
+	send_user "(AccountingStorageEnforce)\n"
+	exit 0
+}
 if {[test_front_end] != 0} {
 	send_user "\nWARNING: This test is incompatible with front-end systems\n"
 	exit 0
diff --git a/testsuite/expect/test14.6 b/testsuite/expect/test14.6
index cb55666d4da..3ebf0319cf7 100755
--- a/testsuite/expect/test14.6
+++ b/testsuite/expect/test14.6
@@ -42,6 +42,11 @@ set job_id               0
 
 print_header $test_id
 
+if {![test_accting_steps]} {
+	send_user "\nWARNING: This test can not be run with nosteps or nojobs "
+	send_user "(AccountingStorageEnforce)\n"
+	exit 0
+}
 if {[test_front_end] != 0} {
 	send_user "\nWARNING: This test is incompatible with front-end systems\n"
 	exit 0
diff --git a/testsuite/expect/test7.13 b/testsuite/expect/test7.13
index ef5f681e73c..8ba353cd4dd 100755
--- a/testsuite/expect/test7.13
+++ b/testsuite/expect/test7.13
@@ -39,6 +39,11 @@ set file_prog2       "test$test_id.prog2"
 
 print_header $test_id
 
+if {![test_accting_steps]} {
+	send_user "\nWARNING: This test can not be run with nosteps or nojobs "
+	send_user "(AccoutingStorageEnforce)\n"
+	exit 0
+}
 if {[test_launch_poe]} {
 	send_user "\nWARNING: This test is incompatible with launch/poe systems\n"
 	exit 0
diff --git a/testsuite/expect/test7.9 b/testsuite/expect/test7.9
index bfbfd011da7..3e7360801f4 100755
--- a/testsuite/expect/test7.9
+++ b/testsuite/expect/test7.9
@@ -42,6 +42,11 @@ set iterations       50
 
 print_header $test_id
 
+if {![test_accting_steps]} {
+	send_user "\nWARNING: This test can not be run with nosteps or nojobs "
+	send_user "(AccoutingStorageEnforce)\n"
+	exit 0
+}
 #
 # Test is incompatible with proctrack/aix, proctrack/rms, proctrack/sgi_job,
 # proctrack/cray, and switch/elan
-- 
GitLab