From beb0ab7d3a0a342a1750c2fc1a0cd203389bb03c Mon Sep 17 00:00:00 2001
From: Morris Jette <jette@schedmd.com>
Date: Mon, 6 Oct 2014 16:21:57 -0700
Subject: [PATCH] test suite mods for launch/poe

---
 testsuite/expect/test17.38       |  2 +-
 testsuite/expect/test32.7        |  2 +-
 testsuite/expect/test5.9         |  8 +++++++-
 testsuite/expect/test7.12        | 15 ++++++++++++---
 testsuite/expect/test7.12.prog.c |  7 +++----
 5 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/testsuite/expect/test17.38 b/testsuite/expect/test17.38
index 8de1b683d67..fc0b8d33b05 100755
--- a/testsuite/expect/test17.38
+++ b/testsuite/expect/test17.38
@@ -56,7 +56,7 @@ function gettime \{
 echo \"starting...\"
 T=\"$\(date +%s)\"
 trap \"echo Got SIGINT 2; gettime; exit 1\" 2
-$srun $file_prog &
+$srun ./$file_prog &
 while :
 do
 	:
diff --git a/testsuite/expect/test32.7 b/testsuite/expect/test32.7
index 91db629541f..8ebe448c1c7 100755
--- a/testsuite/expect/test32.7
+++ b/testsuite/expect/test32.7
@@ -127,7 +127,7 @@ if {$exit_code == 0} {
 	exec $bin_rm -f $file_in $file_out
 	send_user "\nSUCCESS\n"
 } elseif {[test_launch_poe]} {
-	send_user "\nWARNING: Sporatic failures with POE are expected. Please retest.\n"
+	send_user "\nWARNING: Frequent failures with POE are expected due. Please retest.\n"
 #	POE BUG: If the application exits immediately then pmdv12 hangs until
 #	slurm kills it with a timeout, thus the sleep below is required:
 #	F S   UID   PID  PPID  C PRI  NI ADDR SZ WCHAN TTY   TIME CMD
diff --git a/testsuite/expect/test5.9 b/testsuite/expect/test5.9
index 6fc29a91a14..84e86b51244 100755
--- a/testsuite/expect/test5.9
+++ b/testsuite/expect/test5.9
@@ -104,6 +104,12 @@ if {$available < 2} {
     exit $exit_code
 }
 
+if {[test_launch_poe]} {
+	set step_id 1
+} else {
+	set step_id 0
+}
+
 remove_acct [get_cluster_name] $test_acct
 
 # Run a job to get a usable node to test
@@ -356,7 +362,7 @@ if {$match != 1} {
 # jobid
 set sq_step_format(jobid)       $job_id
 # stepid
-set sq_step_format(stepid)      $job_id.0
+set sq_step_format(stepid)      $job_id.$step_id
 # stepname
 set sq_step_format(stepname)    "sleep"
 # state
diff --git a/testsuite/expect/test7.12 b/testsuite/expect/test7.12
index 502a95f6765..4cff160e0da 100755
--- a/testsuite/expect/test7.12
+++ b/testsuite/expect/test7.12
@@ -48,6 +48,14 @@ if {[test_front_end] != 0} {
         exit 0
 }
 
+if {[test_launch_poe]} {
+	set step_id   1
+	set pid_count 2
+} else {
+	set step_id   0
+	set pid_count 1
+}
+
 #
 # Delete left-over program and rebuild it
 #
@@ -115,7 +123,7 @@ if {$debug} {
 set job_matches  0
 set pid_matches  0
 set step_matches 0
-spawn ./$test_prog $job_id
+spawn ./$test_prog $job_id $step_id
 expect {
 	-re "job_id:$job_id step_id" {
 		incr step_matches
@@ -143,13 +151,14 @@ if {$step_matches != 1} {
 	send_user "\nFAILURE: error running slurm_job_step_stat() program ($step_matches != 1)\n"
 	set exit_code 1
 }
-if {$pid_matches != 1} {
-	send_user "\nWARNING: Failed to load PIDs associated with job step ($pid_matches != 1).\n"
+if {$pid_matches != $pid_count} {
+	send_user "\nWARNING: Failed to load PIDs associated with job step ($pid_matches != $pid_count).\n"
 	send_user "         This is dependent upon the ProctrackType configured.\n"
 	send_user "         proctrack/pgid does NOT support this functionality.\n"
 }
 if {$job_matches != 1} {
 	send_user "\nFAILURE: Failed to load job info for this job ($job_matches != 1).\n"
+	set exit_code 1
 }
 
 cancel_job $job_id
diff --git a/testsuite/expect/test7.12.prog.c b/testsuite/expect/test7.12.prog.c
index 28180c19ed9..f88e4b37cb1 100644
--- a/testsuite/expect/test7.12.prog.c
+++ b/testsuite/expect/test7.12.prog.c
@@ -40,13 +40,12 @@ main(int argc, char **argv)
 	job_info_msg_t *job_info_msg;
 	slurm_job_info_t *job_ptr;
 
-	if (argc < 2) {
-		printf("Usage: job_id [step_id]\n");
+	if (argc < 3) {
+		printf("Usage: job_id step_id\n");
 		exit(1);
 	}
 	job_id = atoi(argv[1]);
-	if (argc > 2)
-		step_id = atoi(argv[2]);
+	step_id = atoi(argv[2]);
 	printf("job_id:%u step_id:%u\n", job_id, step_id);
 
 	rc = slurm_job_step_stat(job_id, step_id, NULL, &resp);
-- 
GitLab