From 26d93c72cf177db5ebfff2fcc99d94fc493e3110 Mon Sep 17 00:00:00 2001
From: Morris Jette <jette@schedmd.com>
Date: Fri, 20 Jan 2012 16:04:34 -0800
Subject: [PATCH] Minor patches to test suite

---
 testsuite/expect/test1.59        | 16 +++++++++++++---
 testsuite/expect/test24.1.prog.c |  1 +
 testsuite/expect/test4.12        | 13 ++++++++++---
 3 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/testsuite/expect/test1.59 b/testsuite/expect/test1.59
index 62a3237f044..fdc12fcb0a3 100755
--- a/testsuite/expect/test1.59
+++ b/testsuite/expect/test1.59
@@ -36,6 +36,7 @@ source ./globals
 
 set test_id     "1.59"
 set exit_code   0
+set file_in     "test$test_id.input"
 set num_nodes   3
 set node_count  0
 set task_count  0
@@ -53,7 +54,7 @@ if {[string compare [switch_type] "elan"] == 0} {
 	send_user "\nWARNING: This test incompatible with Elan switch\n"
 	exit $exit_code
 }
-#find out if we have enough nodes to test functionality
+# find out if we have enough nodes to test functionality
 set partition [default_partition]
 spawn $scontrol show partition $partition
 expect {
@@ -84,8 +85,16 @@ set node2 0
 set node3 0
 set node4 0
 
+#
+# Build input script file
+#
+make_bash_script $file_in "
+  export PS1=\"$prompt\"
+  $bin_bash --norc
+"
+
 set timeout $max_job_delay
-spawn $salloc -N$num_nodes -v bash
+set salloc_pid [spawn $salloc -N$num_nodes -v -t1 ./$file_in]
 expect {
 	-re "salloc: Granted job allocation ($number)" {
 		set job_id $expect_out(1,string)
@@ -96,13 +105,14 @@ expect {
 	}
 	timeout {
 		send_user "\nFAILURE: srun not responding\n"
-		kill_srun
+		slow_kill $salloc_pid
 		set exit_code 1
 	}
 	eof {
 		wait
 	}
 }
+exec $bin_rm -f $file_in
 if {$job_id == 0} {
 	send_user "\nFAILURE: salloc failure\n"
 	exit 1
diff --git a/testsuite/expect/test24.1.prog.c b/testsuite/expect/test24.1.prog.c
index 1779e397605..5a3e26290b1 100644
--- a/testsuite/expect/test24.1.prog.c
+++ b/testsuite/expect/test24.1.prog.c
@@ -50,6 +50,7 @@
 #include "src/sshare/sshare.h"
 
 /* set up some fake system */
+void *acct_db_conn = NULL;
 uint32_t cluster_cpus = 50;
 int long_flag = 1;
 int exit_code = 0;
diff --git a/testsuite/expect/test4.12 b/testsuite/expect/test4.12
index c6d832d0e9b..4adeb197af2 100755
--- a/testsuite/expect/test4.12
+++ b/testsuite/expect/test4.12
@@ -213,9 +213,10 @@ proc sinfo_test_2 { node proc_cnt total_procs } {
 
 # allocate a set of nodes (node_cnt) and the quit right after
 proc allocate_and_quit { node proc_cnt total_procs } {
-	global salloc scontrol sinfo number alpha_numeric_under
-	global prompt select_type procs_per_node
+	global bin_bash salloc scontrol sinfo number alpha_numeric_under
+	global prompt select_type procs_per_node test_id bin_rm
 
+	set file_in "test$test_id.input"
 	set job_id 0
 	set num_alloc 0
 	set block ""
@@ -223,7 +224,12 @@ proc allocate_and_quit { node proc_cnt total_procs } {
 	set timeout 60
 	set idle_cpus [expr $total_procs - $proc_cnt]
 
-	set mypid [spawn $salloc -w $node -N 1 -t 5 -n $proc_cnt bash]
+	make_bash_script $file_in "
+	  export PS1=\"$prompt\"
+	  $bin_bash --norc
+	"
+
+	set mypid [spawn $salloc -w $node -N 1 -t 5 -n $proc_cnt ./$file_in]
 	expect {
 		-re "Granted job allocation ($number)" {
 			set job_id $expect_out(1,string)
@@ -268,6 +274,7 @@ proc allocate_and_quit { node proc_cnt total_procs } {
 			wait
 		}
 	}
+	exec $bin_rm -f $file_in
 
 	return $rc
 }
-- 
GitLab