From 8d0cc620c763b77ddcbb6b2cdc29d9a0c511bdf1 Mon Sep 17 00:00:00 2001
From: Moe Jette <jette1@llnl.gov>
Date: Wed, 13 Sep 2006 19:44:54 +0000
Subject: [PATCH] Add test for sattach layout

---
 testsuite/expect/README   |  3 ++-
 testsuite/expect/test16.4 | 30 ++++++++++++++++++++++++++++--
 2 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/testsuite/expect/README b/testsuite/expect/README
index 4a4b3bb3241..7c7b7228ad9 100644
--- a/testsuite/expect/README
+++ b/testsuite/expect/README
@@ -374,7 +374,8 @@ test16.1   Confirm sattach usage option works (--usage option).
 test16.2   Confirm sattach help option works (--help option).
 test16.3   Confirm that sattach reports a proper version number
            (--version option).
-test16.4   Basic sattach functionality test (--verbose and --label options).
+test16.4   Basic sattach functionality test (--layout, --verbose and
+           --label options).
 
 
 test17.#   Testing of sbatch options.
diff --git a/testsuite/expect/test16.4 b/testsuite/expect/test16.4
index 9f8163a3fb8..bd0632d0b34 100755
--- a/testsuite/expect/test16.4
+++ b/testsuite/expect/test16.4
@@ -1,7 +1,8 @@
 #!/usr/bin/expect
 ############################################################################
 # Purpose: Test of SLURM functionality
-#          Basic sattach functionality test (--verbose and --label options).
+#          Basic sattach functionality test (--layout, --verbose and 
+#          --label options).
 #
 # Output:  "TEST: #.#" followed by "SUCCESS" if test was successful, OR
 #          "FAILURE: ..." otherwise with an explanation of the failure, OR
@@ -86,6 +87,31 @@ if {$matches != 4} {
 	exit 1
 }
 
+#
+# Get task layout information
+#
+set matches     0
+spawn $sattach --layout $job_id.0
+set attach_id $spawn_id
+expect {
+	-i $attach_id
+	-re "4 tasks, ($number) nodes" {
+		incr matches
+		exp_continue
+	}
+	timeout {
+		send_user "\nFAILURE: sattach not responding\n"
+		set exit_code 1
+	}
+	eof {
+		wait
+	}
+}
+if {$matches == 0} {
+	send_user "\nFAILURE: layout information not printed\n"
+	set exit_code 1
+}
+
 #
 # Attach to initial program
 #
@@ -116,7 +142,7 @@ expect {
 }
 if {$matches != 5} {
 	send_user "\nFAILURE: job run time failure\n"
-	set exit_code   1
+	set exit_code 1
 }
 
 #
-- 
GitLab