From 58bf4d793efd85f11c9749fe19a7446b45a4fae8 Mon Sep 17 00:00:00 2001
From: Morris Jette <jette@schedmd.com>
Date: Thu, 21 Apr 2016 11:32:44 -0700
Subject: [PATCH] Fix tests for some configurations

Some portions of tests 21.30 and 21.34 failed with accounting and
priority basic. These changes disable portions of those tests as
needed based upon configuration.
---
 testsuite/expect/inc21.34_tests | 106 ++++++++++++++++++--------------
 testsuite/expect/test21.30      |  41 +++++++-----
 testsuite/expect/test21.34      |   5 ++
 3 files changed, 90 insertions(+), 62 deletions(-)

diff --git a/testsuite/expect/inc21.34_tests b/testsuite/expect/inc21.34_tests
index 4bd8c3e8729..fee893097bf 100644
--- a/testsuite/expect/inc21.34_tests
+++ b/testsuite/expect/inc21.34_tests
@@ -54,7 +54,7 @@ proc part_test { } {
 	global grpcpurunmin_num grpmem_num grpwall_num maxcpumin_num
 	global maxwall_num maxcpuspu_num maxnodespu_num
 	global exit_code part_qos mod_job_qos time_spacing selectparam
-	global nthreads job_qos mod_part_qos
+	global nthreads job_qos mod_part_qos prio_multifactor
 
 	# We will set qostest with the qos that we will test since the some of
 	# the 21.30 inc test require the qostest variable
@@ -207,19 +207,22 @@ proc part_test { } {
 
 	#
 	# Test GroupCPURunMins
+	# Requires priority/multifactor to properly handle decay well
 	#
-	set mod_job_qos(GrpCpuRunMin) 1
-	set mod_part_qos(GrpCpuRunMin) $grpcpurunmin_num
-	mod_qos $part_qos [array get mod_part_qos]
-	mod_qos $job_qos [array get mod_job_qos]
-	sleep $time_spacing
-	inc21_30_10
-	if {$exit_code != 0 } {
-		cleanup
-		exit 1
+	if { $prio_multifactor != 0 } {
+		set mod_job_qos(GrpCpuRunMin) 1
+		set mod_part_qos(GrpCpuRunMin) $grpcpurunmin_num
+		mod_qos $part_qos [array get mod_part_qos]
+		mod_qos $job_qos [array get mod_job_qos]
+		sleep $time_spacing
+		inc21_30_10
+		if {$exit_code != 0 } {
+			cleanup
+			exit 1
+		}
+		set mod_job_qos(GrpCpuRunMin) "-1"
+		set mod_part_qos(GrpCpuRunMin) "-1"
 	}
-	set mod_job_qos(GrpCpuRunMin) "-1"
-	set mod_part_qos(GrpCpuRunMin) "-1"
 
 	#
 	# Test Group Memory
@@ -239,19 +242,22 @@ proc part_test { } {
 
 	#
 	# Test Group wall
+	# Requires priority/multifactor to properly handle decay well
 	#
-	set mod_job_qos(GrpWall) 1
-	set mod_part_qos(GrpWall) $grpwall_num
-	mod_qos $part_qos [array get mod_part_qos]
-	mod_qos $job_qos [array get mod_job_qos]
-	sleep $time_spacing
-	inc21_34_2 $part_qos
-	if {$exit_code != 0 } {
-		cleanup
-		exit 1
+	if { $prio_multifactor != 0 } {
+		set mod_job_qos(GrpWall) 1
+		set mod_part_qos(GrpWall) $grpwall_num
+		mod_qos $part_qos [array get mod_part_qos]
+		mod_qos $job_qos [array get mod_job_qos]
+		sleep $time_spacing
+		inc21_34_2 $part_qos
+		if {$exit_code != 0 } {
+			cleanup
+			exit 1
+		}
+		set mod_job_qos(GrpWall) "-1"
+		set mod_part_qos(GrpWall) "-1"
 	}
-	set mod_job_qos(GrpWall) "-1"
-	set mod_part_qos(GrpWall) "-1"
 
 	#
 	# Test Max Cpu Mins
@@ -355,7 +361,7 @@ proc qos_test { } {
 	global grpcpurunmin_num grpmem_num grpwall_num maxcpumin_num
 	global maxwall_num maxcpuspu_num maxnodespu_num
 	global exit_code job_qos mod_job_qos time_spacing selectparam
-	global nthreads part_qos mod_part_qos
+	global nthreads part_qos mod_part_qos prio_multifactor
 
 	# We will set qostest with the qos that we will test since the some of
 	# the 21.30 inc test require the qostest variable
@@ -508,19 +514,22 @@ proc qos_test { } {
 
 	#
 	# Test GroupCPURunMins
+	# Requires priority/multifactor to properly handle decay well
 	#
-	set mod_job_qos(GrpCpuRunMin) $grpcpurunmin_num
-	set mod_part_qos(GrpCpuRunMin) 1
-	mod_qos $job_qos [array get mod_job_qos]
-	mod_qos $part_qos [array get mod_part_qos]
-	sleep $time_spacing
-	inc21_30_10
-	if {$exit_code != 0 } {
-		cleanup
-		exit 1
+	if { $prio_multifactor != 0 } {
+		set mod_job_qos(GrpCpuRunMin) $grpcpurunmin_num
+		set mod_part_qos(GrpCpuRunMin) 1
+		mod_qos $job_qos [array get mod_job_qos]
+		mod_qos $part_qos [array get mod_part_qos]
+		sleep $time_spacing
+		inc21_30_10
+		if {$exit_code != 0 } {
+			cleanup
+			exit 1
+		}
+		set mod_job_qos(GrpCpuRunMin) "-1"
+		set mod_part_qos(GrpCpuRunMin) "-1"
 	}
-	set mod_job_qos(GrpCpuRunMin) "-1"
-	set mod_part_qos(GrpCpuRunMin) "-1"
 
 	#
 	# Test Group Memory
@@ -540,19 +549,22 @@ proc qos_test { } {
 
 	#
 	# Test Group wall
-	#
-	set mod_job_qos(GrpWall) $grpwall_num
-	set mod_part_qos(GrpWall) 1
-	mod_qos $job_qos [array get mod_job_qos]
-	mod_qos $part_qos [array get mod_part_qos]
-	sleep $time_spacing
-	inc21_34_2 $job_qos
-	if {$exit_code != 0 } {
-		cleanup
-		exit 1
+	# Requires priority/multifactor to properly handle decay well
+	#
+	if { $prio_multifactor != 0 } {
+		set mod_job_qos(GrpWall) $grpwall_num
+		set mod_part_qos(GrpWall) 1
+		mod_qos $job_qos [array get mod_job_qos]
+		mod_qos $part_qos [array get mod_part_qos]
+		sleep $time_spacing
+		inc21_34_2 $job_qos
+		if {$exit_code != 0 } {
+			cleanup
+			exit 1
+		}
+		set mod_job_qos(GrpWall) "-1"
+		set mod_part_qos(GrpWall) "-1"
 	}
-	set mod_job_qos(GrpWall) "-1"
-	set mod_part_qos(GrpWall) "-1"
 
 	#
 	# Test Max Cpu Mins
diff --git a/testsuite/expect/test21.30 b/testsuite/expect/test21.30
index 39be5d91e36..78e5eef0b46 100755
--- a/testsuite/expect/test21.30
+++ b/testsuite/expect/test21.30
@@ -146,12 +146,17 @@ expect {
 		wait
 	}
 }
-
 if {$tmpc == 0 || $tmpn == 0} {
 	send_user "\nWARNING: not enough Nodes and/or CPUs\n"
 	exit 0
 }
 
+if { ![string compare [priority_type] "multifactor"] } {
+	set prio_multifactor 1
+} else {
+	set prio_multifactor 0
+}
+
 # Checks the state of the job
 proc check_state { job } {
 
@@ -554,15 +559,18 @@ set mod_qos_vals(GrpCpuMin) "-1"
 
 #
 # Test GroupCPURunMins
+# Requires priority/multifactor to properly handle decay well
 #
-set mod_qos_vals(GrpCpuRunMin) $grpcpurunmin_num
-mod_qos $qostest [array get mod_qos_vals]
-sleep $time_spacing
-inc21_30_10
-if {$exit_code != 0 } {
-	endit
+if { $prio_multifactor != 0 } {
+	set mod_qos_vals(GrpCpuRunMin) $grpcpurunmin_num
+	mod_qos $qostest [array get mod_qos_vals]
+	sleep $time_spacing
+	inc21_30_10
+	if {$exit_code != 0 } {
+		endit
+	}
+	set mod_qos_vals(GrpCpuRunMin) "-1"
 }
-set mod_qos_vals(GrpCpuRunMin) "-1"
 
 #
 # Test Group Memory
@@ -578,15 +586,18 @@ set mod_qos_vals(GrpMem) "-1"
 
 #
 # Test Group wall
+# Requires priority/multifactor to properly handle decay well
 #
-set mod_qos_vals(GrpWall) $grpwall_num
-mod_qos $qostest [array get mod_qos_vals]
-sleep $time_spacing
-inc21_30_12
-if {$exit_code != 0 } {
-	endit
+if { $prio_multifactor != 0 } {
+	set mod_qos_vals(GrpWall) $grpwall_num
+	mod_qos $qostest [array get mod_qos_vals]
+	sleep $time_spacing
+	inc21_30_12
+	if {$exit_code != 0 } {
+		endit
+	}
+	set mod_qos_vals(GrpWall) "-1"
 }
-set mod_qos_vals(GrpWall) "-1"
 
 #
 # Test Max Cpu Mins
diff --git a/testsuite/expect/test21.34 b/testsuite/expect/test21.34
index 0b955806579..5ddd0d04a84 100755
--- a/testsuite/expect/test21.34
+++ b/testsuite/expect/test21.34
@@ -240,6 +240,11 @@ if {[test_super_user] == 0} {
 	send_user "\nWARNING Test can only be ran as SlurmUser\n"
 	exit 0
 }
+if { ![string compare [priority_type] "multifactor"] } {
+	set prio_multifactor 1
+} else {
+	set prio_multifactor 0
+}
 
 # Remove any vestigial data
 cleanup
-- 
GitLab