From 1c89030ac33bdcbc55a1704c4e83e1afa92df04e Mon Sep 17 00:00:00 2001
From: Moe Jette <jette1@llnl.gov>
Date: Mon, 12 Dec 2005 22:44:03 +0000
Subject: [PATCH] Make sure accounting is configured at start of accounting
 test.

---
 testsuite/expect/test12.2 | 31 +++++++++++++++++++++----------
 1 file changed, 21 insertions(+), 10 deletions(-)

diff --git a/testsuite/expect/test12.2 b/testsuite/expect/test12.2
index 197b3e777ba..b8eca0e570b 100755
--- a/testsuite/expect/test12.2
+++ b/testsuite/expect/test12.2
@@ -36,7 +36,6 @@ set exit_code   0
 set file_prog   "test$test_id.prog"
 set job_id      0
 set matches     0
-set not_support 0
 
 # job paramters
 set mem_size    100000
@@ -45,6 +44,27 @@ set ret_code    42
 
 print_header $test_id
 
+#
+# Check if accounting is enabled
+#
+set supported 0
+log_user 0
+spawn $scontrol show config
+expect {
+	-re "jobacct/log" {
+		set supported 1
+		exp_continue
+	}
+	eof {
+		wait
+	}
+}
+log_user 1
+if {$supported == 0} {
+	send_user "\nWARNING: job accounting not configured on this system\n"
+	exit 0
+}
+
 #
 # Delete left-over program and rebuild it
 #
@@ -85,10 +105,6 @@ exec $bin_sleep 5
  
 spawn $sacct --noheader --jobstep=$job_id.0 --fields jobstep,jobname,status,error
 expect {
-	-re "SLURM accounting is disabled" {
-		set not_support 1
-		exp_continue
-	}
 	-re "$job_id\.0" {
 		incr matches
 		exp_continue
@@ -113,11 +129,6 @@ expect {
 		wait
 	}
 }
-
-if {$not_support != 0} {
-	send_user "\nWARNING: can not test without accounting enabled\n"
-	exit 0
-}
 if {$matches != 4} {
 	send_user "\nFAILURE: sacct reporting failed\n"
 	set exit_code 1
-- 
GitLab