diff --git a/testsuite/expect/README b/testsuite/expect/README
index 8bed904febafb28c020eadb9a79f8330ff61f83e..0fab77588a4e07d6ce2290149fe484ddd6d9e7b2 100644
--- a/testsuite/expect/README
+++ b/testsuite/expect/README
@@ -148,6 +148,7 @@ test1.86   Confirm node selection from within a job step on existing allocation
 test1.87   Confirm node selection from within a job step on existing allocation
            (--relative, --nodes and --nprocs options).
 test1.88   Basic MPI functionality tests.
+test1.89   Test of CPU affinity support.
 **NOTE**   The above tests for mutliple processor/partition systems only
 
 test2.#    Testing of scontrol options (to be run as unprivileged user). 
diff --git a/testsuite/expect/test1.89 b/testsuite/expect/test1.89
new file mode 100755
index 0000000000000000000000000000000000000000..2f9a26bfa51b9a27282db059db08afdc4604c16e
--- /dev/null
+++ b/testsuite/expect/test1.89
@@ -0,0 +1,149 @@
+#!/usr/bin/expect
+############################################################################
+# Purpose: Test of SLURM functionality
+#          Test of CPU affinity support.
+#
+# Output:  "TEST: #.#" followed by "SUCCESS" if test was successful, OR
+#          "WARNING: ..." with an explanation of why the test can't be made, OR
+#          "FAILURE: ..." otherwise with an explanation of the failure, OR
+#          anything else indicates a failure mode that must be investigated.
+############################################################################
+# Copyright (C) 2005 The Regents of the University of California.
+# Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
+# Written by Morris Jette <jette1@llnl.gov>
+# UCRL-CODE-2002-040.
+# 
+# This file is part of SLURM, a resource management program.
+# For details, see <http://www.llnl.gov/linux/slurm/>.
+#  
+# SLURM is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 2 of the License, or (at your option)
+# any later version.
+# 
+# SLURM is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+# details.
+# 
+# You should have received a copy of the GNU General Public License along
+# with SLURM; if not, write to the Free Software Foundation, Inc.,
+# 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
+############################################################################
+source ./globals
+
+set test_id     "1.89"
+set exit_code   0
+set file_prog   "test$test_id.prog"
+
+print_header $test_id
+
+#
+# Test if task affinity support is supported.
+#
+set affinity 0
+log_user 0
+spawn $scontrol show config
+expect {
+	-re "task/affinity" {
+		set affinity 1
+		exp_continue
+	}
+	eof {
+		wait
+	}
+}
+log_user 1
+if {$affinity == 0} {
+	send_user "\nWARNING: task affinity not supported on this system\n"
+	exit 0
+}
+
+#
+# Build a test program to report affinity by task
+#
+exec $bin_rm -f $file_prog
+exec $bin_make -f /dev/null $file_prog
+exec $bin_chmod 700 $file_prog
+
+#
+# Create an allocation
+#
+spawn $srun --allocate -N1 --verbose -t2
+expect -re "jobid ($number).*"
+set job_id $expect_out(1,string)
+
+#
+# Run a job step to get allocated processor count and affinity
+#
+expect -re $prompt
+set task_cnt 0
+send "$srun -c1 $file_prog\n"
+expect {
+	-re "TASK_ID:($number),MASK:($number)" {
+		incr task_cnt
+		set mask $expect_out(2,string)
+		exp_continue
+	}
+	-re "error" {
+		send_user "\nFAILURE: some error occurred\n"
+		set exit_code 1
+		exp_continue
+	}
+	timeout {
+		send_user "\nFAILURE: srun (from --allocate) not responding\n"
+		set exit_code 1
+		exp_continue
+	}
+	-re $prompt
+}
+
+#
+# Run a job step with affinity
+#
+set task_mask 0
+send "$srun -c1 --cpu_bind=rank $file_prog\n"
+expect {
+	-re "TASK_ID:($number),MASK:($number)" {
+		incr task_mask $expect_out(2,string)
+		exp_continue
+	}
+	-re "error" {
+		send_user "\nFAILURE: some error occurred\n"
+		set exit_code 1
+		exp_continue
+	}
+	timeout {
+		send_user "\nFAILURE: srun (from --allocate) not responding\n"
+		set exit_code 1
+		exp_continue
+	}
+	-re $prompt
+}
+if {$task_mask != $mask} {
+	send_user "\nFAILURE: affinity mask inconsistency ($task_mask,$mask)\n"
+	set exit_code 1
+}
+
+send "exit\n"
+expect {
+	-re "error" {
+		send_user "\nFAILURE: some error occurred\n"
+		set exit_code 1
+	}
+	timeout {
+		send_user "\nFAILURE: srun (from --allocate) not responding\n"
+		kill_srun
+		set exit_code 1
+		exp_continue
+	}
+	eof {
+		wait
+	}
+}
+	
+if {$exit_code == 0} {
+	exec $bin_rm -f $file_prog
+	send_user "\nSUCCESS\n"
+}
+exit $exit_code
diff --git a/testsuite/expect/test1.89.prog.c b/testsuite/expect/test1.89.prog.c
new file mode 100644
index 0000000000000000000000000000000000000000..70ad0230bfd3cd67410582a47eb9b1ad6085c4f8
--- /dev/null
+++ b/testsuite/expect/test1.89.prog.c
@@ -0,0 +1,26 @@
+#include <errno.h>
+#include <sched.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+main (int argc, char **argv)
+{
+	char *task_str;
+	unsigned long mask;
+	int task_id;
+
+	if (sched_getaffinity((pid_t) 0, (unsigned int) sizeof(mask), &mask)
+			!= 0) {
+		fprintf(stderr, "ERROR: sched_getaffinity: %s\n", 
+			strerror(errno));
+		exit(1);
+	}
+	if ((task_str = getenv("SLURM_PROCID")) == NULL) {
+		fprintf(stderr, "ERROR: getenv(SLURM_TASKID) failed\n");
+		exit(1);
+	}
+	task_id = atoi(task_str);
+	printf("TASK_ID:%d,MASK:%lu\n", task_id, mask);
+	exit(0);
+}