summaryrefslogtreecommitdiffstats
path: root/testsuites/smptests
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2011-06-28 21:08:48 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2011-06-28 21:08:48 +0000
commite049eeae908fe5d6418433aa1495c796cc58424f (patch)
tree9ae2ca088f2dfc3787d5965e904b1c738e14ad57 /testsuites/smptests
parent2011-05-24 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-e049eeae908fe5d6418433aa1495c796cc58424f.tar.bz2
2011-06-28 Joel Sherrill <joel.sherrill@oarcorp.com>
* .configure.ac.swp, ChangeLog, Makefile.am, README, config.h.in, configure.ac, smp01/.cvsignore, smp01/Makefile.am, smp01/init.c, smp01/smp01.doc, smp01/smp01.scn, smp01/system.h, smp01/tasks.c, smp02/.cvsignore, smp02/Makefile.am, smp02/init.c, smp02/smp02.doc, smp02/smp02.scn, smp02/system.h, smp02/tasks.c, smp03/.cvsignore, smp03/Makefile.am, smp03/init.c, smp03/smp03.doc, smp03/smp03.scn, smp03/system.h, smp03/tasks.c, smp04/.cvsignore, smp04/Makefile.am, smp04/init.c, smp04/smp04.doc, smp04/smp04.scn, smp04/system.h, smp04/tasks.c, smp05/.cvsignore, smp05/Makefile.am, smp05/init.c, smp05/smp05.doc, smp05/smp05.scn, smp06/.cvsignore, smp06/Makefile.am, smp06/init.c, smp06/smp06.doc, smp06/smp06.scn, smp07/.cvsignore, smp07/Makefile.am, smp07/init.c, smp07/smp07.doc, smp07/smp07.scn, smp08/.cvsignore, smp08/Makefile.am, smp08/init.c, smp08/smp08.doc, smp08/smp08.scn, smp08/system.h, smp08/tasks.c, smp09/.cvsignore, smp09/Makefile.am, smp09/init.c, smp09/smp09.doc, smp09/smp09.scn: New files.
Diffstat (limited to 'testsuites/smptests')
-rw-r--r--testsuites/smptests/.configure.ac.swpbin0 -> 12237 bytes
-rw-r--r--testsuites/smptests/ChangeLog19
-rw-r--r--testsuites/smptests/Makefile.am22
-rw-r--r--testsuites/smptests/README17
-rw-r--r--testsuites/smptests/config.h.in19
-rw-r--r--testsuites/smptests/configure.ac47
-rw-r--r--testsuites/smptests/smp01/.cvsignore2
-rw-r--r--testsuites/smptests/smp01/Makefile.am27
-rw-r--r--testsuites/smptests/smp01/init.c87
-rw-r--r--testsuites/smptests/smp01/smp01.doc21
-rw-r--r--testsuites/smptests/smp01/smp01.scn8
-rw-r--r--testsuites/smptests/smp01/system.h54
-rw-r--r--testsuites/smptests/smp01/tasks.c45
-rw-r--r--testsuites/smptests/smp02/.cvsignore2
-rw-r--r--testsuites/smptests/smp02/Makefile.am29
-rw-r--r--testsuites/smptests/smp02/init.c102
-rw-r--r--testsuites/smptests/smp02/smp02.doc19
-rw-r--r--testsuites/smptests/smp02/smp02.scn25
-rw-r--r--testsuites/smptests/smp02/system.h73
-rw-r--r--testsuites/smptests/smp02/tasks.c63
-rw-r--r--testsuites/smptests/smp03/.cvsignore2
-rw-r--r--testsuites/smptests/smp03/Makefile.am29
-rw-r--r--testsuites/smptests/smp03/init.c94
-rw-r--r--testsuites/smptests/smp03/smp03.doc19
-rw-r--r--testsuites/smptests/smp03/smp03.scn7
-rw-r--r--testsuites/smptests/smp03/system.h68
-rw-r--r--testsuites/smptests/smp03/tasks.c38
-rw-r--r--testsuites/smptests/smp04/.cvsignore2
-rw-r--r--testsuites/smptests/smp04/Makefile.am29
-rw-r--r--testsuites/smptests/smp04/init.c119
-rw-r--r--testsuites/smptests/smp04/smp04.doc17
-rw-r--r--testsuites/smptests/smp04/smp04.scn8
-rw-r--r--testsuites/smptests/smp04/system.h70
-rw-r--r--testsuites/smptests/smp04/tasks.c31
-rw-r--r--testsuites/smptests/smp05/.cvsignore2
-rw-r--r--testsuites/smptests/smp05/Makefile.am27
-rw-r--r--testsuites/smptests/smp05/init.c76
-rw-r--r--testsuites/smptests/smp05/smp05.doc22
-rw-r--r--testsuites/smptests/smp05/smp05.scn5
-rw-r--r--testsuites/smptests/smp06/.cvsignore2
-rw-r--r--testsuites/smptests/smp06/Makefile.am27
-rw-r--r--testsuites/smptests/smp06/init.c124
-rw-r--r--testsuites/smptests/smp06/smp06.doc25
-rw-r--r--testsuites/smptests/smp06/smp06.scn7
-rw-r--r--testsuites/smptests/smp07/.cvsignore2
-rw-r--r--testsuites/smptests/smp07/Makefile.am27
-rw-r--r--testsuites/smptests/smp07/init.c164
-rw-r--r--testsuites/smptests/smp07/smp07.doc24
-rw-r--r--testsuites/smptests/smp07/smp07.scn6
-rw-r--r--testsuites/smptests/smp08/.cvsignore2
-rw-r--r--testsuites/smptests/smp08/Makefile.am29
-rw-r--r--testsuites/smptests/smp08/init.c97
-rw-r--r--testsuites/smptests/smp08/smp08.doc12
-rw-r--r--testsuites/smptests/smp08/smp08.scn16
-rw-r--r--testsuites/smptests/smp08/system.h56
-rw-r--r--testsuites/smptests/smp08/tasks.c59
-rw-r--r--testsuites/smptests/smp09/.cvsignore2
-rw-r--r--testsuites/smptests/smp09/Makefile.am27
-rw-r--r--testsuites/smptests/smp09/init.c88
-rw-r--r--testsuites/smptests/smp09/smp09.doc22
-rw-r--r--testsuites/smptests/smp09/smp09.scn22
61 files changed, 2186 insertions, 0 deletions
diff --git a/testsuites/smptests/.configure.ac.swp b/testsuites/smptests/.configure.ac.swp
new file mode 100644
index 0000000000..2ec752d58c
--- /dev/null
+++ b/testsuites/smptests/.configure.ac.swp
Binary files differ
diff --git a/testsuites/smptests/ChangeLog b/testsuites/smptests/ChangeLog
new file mode 100644
index 0000000000..51cc3fef07
--- /dev/null
+++ b/testsuites/smptests/ChangeLog
@@ -0,0 +1,19 @@
+2011-06-28 Joel Sherrill <joel.sherrill@oarcorp.com>
+
+ * .configure.ac.swp, ChangeLog, Makefile.am, README, config.h.in,
+ configure.ac, smp01/.cvsignore, smp01/Makefile.am, smp01/init.c,
+ smp01/smp01.doc, smp01/smp01.scn, smp01/system.h, smp01/tasks.c,
+ smp02/.cvsignore, smp02/Makefile.am, smp02/init.c, smp02/smp02.doc,
+ smp02/smp02.scn, smp02/system.h, smp02/tasks.c, smp03/.cvsignore,
+ smp03/Makefile.am, smp03/init.c, smp03/smp03.doc, smp03/smp03.scn,
+ smp03/system.h, smp03/tasks.c, smp04/.cvsignore, smp04/Makefile.am,
+ smp04/init.c, smp04/smp04.doc, smp04/smp04.scn, smp04/system.h,
+ smp04/tasks.c, smp05/.cvsignore, smp05/Makefile.am, smp05/init.c,
+ smp05/smp05.doc, smp05/smp05.scn, smp06/.cvsignore,
+ smp06/Makefile.am, smp06/init.c, smp06/smp06.doc, smp06/smp06.scn,
+ smp07/.cvsignore, smp07/Makefile.am, smp07/init.c, smp07/smp07.doc,
+ smp07/smp07.scn, smp08/.cvsignore, smp08/Makefile.am, smp08/init.c,
+ smp08/smp08.doc, smp08/smp08.scn, smp08/system.h, smp08/tasks.c,
+ smp09/.cvsignore, smp09/Makefile.am, smp09/init.c, smp09/smp09.doc,
+ smp09/smp09.scn: New files.
+
diff --git a/testsuites/smptests/Makefile.am b/testsuites/smptests/Makefile.am
new file mode 100644
index 0000000000..175778dbac
--- /dev/null
+++ b/testsuites/smptests/Makefile.am
@@ -0,0 +1,22 @@
+##
+## $Id$
+##
+
+ACLOCAL_AMFLAGS = -I ../aclocal
+
+SUBDIRS =
+
+if SMPTESTS
+SUBDIRS += smp01
+SUBDIRS += smp02
+SUBDIRS += smp03
+SUBDIRS += smp04
+SUBDIRS += smp05
+SUBDIRS += smp06
+SUBDIRS += smp07
+SUBDIRS += smp08
+SUBDIRS += smp09
+endif
+
+include $(top_srcdir)/../automake/subdirs.am
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/smptests/README b/testsuites/smptests/README
new file mode 100644
index 0000000000..7d276ef2f8
--- /dev/null
+++ b/testsuites/smptests/README
@@ -0,0 +1,17 @@
+#
+# COPYRIGHT (c) 1989-2011.
+# On-Line Applications Research Corporation (OAR).
+#
+# The license and distribution terms for this file may be
+# found in the file LICENSE in this distribution or at
+# http://www.rtems.com/license/LICENSE.
+#
+# $Id$
+#
+
+This directory contains the RTEMS SMP Test Suite.
+
+As of June 2011, these tests are known to run on only
+
++ pcp4 BSP using qemu with 2-4 cores
++ leon3 BSP using grsim with 4 cores
diff --git a/testsuites/smptests/config.h.in b/testsuites/smptests/config.h.in
new file mode 100644
index 0000000000..f80de9c383
--- /dev/null
+++ b/testsuites/smptests/config.h.in
@@ -0,0 +1,19 @@
+/* config.h.in. Generated from configure.ac by autoheader. */
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
diff --git a/testsuites/smptests/configure.ac b/testsuites/smptests/configure.ac
new file mode 100644
index 0000000000..a2801bc137
--- /dev/null
+++ b/testsuites/smptests/configure.ac
@@ -0,0 +1,47 @@
+## Process this file with autoconf to produce a configure script.
+##
+## $Id$
+
+AC_PREREQ([2.68])
+AC_INIT([rtems-c-src-tests-smptests],[_RTEMS_VERSION],[http://www.rtems.org/bugzilla])
+AC_CONFIG_SRCDIR([smp01])
+AC_CONFIG_HEADER([config.h])
+RTEMS_TOP([../..],[..])
+
+RTEMS_CANONICAL_TARGET_CPU
+
+AM_INIT_AUTOMAKE([no-define foreign 1.11.1])
+AM_MAINTAINER_MODE
+
+RTEMS_ENABLE_CXX
+
+RTEMS_ENV_RTEMSBSP
+
+RTEMS_PROJECT_ROOT
+
+RTEMS_PROG_CC_FOR_TARGET
+
+RTEMS_PROG_CXX_FOR_TARGET
+RTEMS_CANONICALIZE_TOOLS
+
+RTEMS_CHECK_CUSTOM_BSP(RTEMS_BSP)
+RTEMS_CHECK_CPUOPTS([RTEMS_MULTIPROCESSING])
+RTEMS_CHECK_CXX(RTEMS_BSP)
+RTEMS_CHECK_CPUOPTS([RTEMS_NETWORKING])
+RTEMS_CHECK_CPUOPTS([RTEMS_SMP])
+
+AM_CONDITIONAL(SMPTESTS,test "$rtems_cv_RTEMS_SMP" = "yes")
+
+# Explicitly list all Makefiles here
+AC_CONFIG_FILES([Makefile
+smp01/Makefile
+smp02/Makefile
+smp03/Makefile
+smp04/Makefile
+smp05/Makefile
+smp06/Makefile
+smp07/Makefile
+smp08/Makefile
+smp09/Makefile
+])
+AC_OUTPUT
diff --git a/testsuites/smptests/smp01/.cvsignore b/testsuites/smptests/smp01/.cvsignore
new file mode 100644
index 0000000000..282522db03
--- /dev/null
+++ b/testsuites/smptests/smp01/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/testsuites/smptests/smp01/Makefile.am b/testsuites/smptests/smp01/Makefile.am
new file mode 100644
index 0000000000..a112880372
--- /dev/null
+++ b/testsuites/smptests/smp01/Makefile.am
@@ -0,0 +1,27 @@
+##
+## $Id$
+##
+
+MANAGERS = all
+
+rtems_tests_PROGRAMS = smp01
+smp01_SOURCES = init.c tasks.c system.h ../../support/src/locked_print.c
+
+dist_rtems_tests_DATA = smp01.scn
+dist_rtems_tests_DATA += smp01.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+AM_CPPFLAGS += -DSMPTEST
+
+LINK_OBJS = $(smp01_OBJECTS) $(smp01_LDADD)
+LINK_LIBS = $(smp01_LDLIBS)
+
+smp01$(EXEEXT): $(smp01_OBJECTS) $(smp01_DEPENDENCIES)
+ @rm -f smp01$(EXEEXT)
+ $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/smptests/smp01/init.c b/testsuites/smptests/smp01/init.c
new file mode 100644
index 0000000000..098a980828
--- /dev/null
+++ b/testsuites/smptests/smp01/init.c
@@ -0,0 +1,87 @@
+/*
+ * COPYRIGHT (c) 1989-2011.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#define CONFIGURE_INIT
+#include "system.h"
+
+void Loop() {
+ volatile int i;
+
+ for (i=0; i<300000; i++);
+}
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ int i;
+ char ch;
+ int cpu_num;
+ rtems_id id;
+ rtems_status_code status;
+ bool allDone;
+
+ /* XXX - Delay a bit to allow debug messages from
+ * startup to print. This may need to go away when
+ * debug messages go away.
+ */
+ Loop();
+ locked_print_initialize();
+
+ /* Put start of test message */
+ locked_printf( "\n\n*** SMP01 TEST ***\n" );
+
+ /* Initialize the TaskRan array */
+ for ( i=0; i<rtems_smp_get_number_of_processors() ; i++ ) {
+ TaskRan[i] = false;
+ }
+
+ /* Create and start tasks for each processor */
+ for ( i=1; i< rtems_smp_get_number_of_processors() ; i++ ) {
+ ch = '0' + i;
+
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'A', ch, ' ' ),
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ directive_failed( status, "task create" );
+
+ cpu_num = bsp_smp_processor_id();
+ (" CPU %d start task TA%c\n", cpu_num, ch);
+ status = rtems_task_start( id, Test_task, i+1 );
+ directive_failed( status, "task start" );
+
+ Loop();
+ }
+
+ /* Wait on the all tasks to run */
+ while (1) {
+ allDone = true;
+ for ( i=1; i<rtems_smp_get_number_of_processors() ; i++ ) {
+ if (TaskRan[i] == false)
+ allDone = false;
+ }
+ if (allDone) {
+ Loop();
+ locked_printf( "*** END OF TEST SMP01 ***" );
+ rtems_test_exit( 0 );
+ }
+ }
+
+}
diff --git a/testsuites/smptests/smp01/smp01.doc b/testsuites/smptests/smp01/smp01.doc
new file mode 100644
index 0000000000..e85d0d7bf3
--- /dev/null
+++ b/testsuites/smptests/smp01/smp01.doc
@@ -0,0 +1,21 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989-1999.
+# On-Line Applications Research Corporation (OAR).
+#
+# The license and distribution terms for this file may be
+# found in the file LICENSE in this distribution or at
+# http://www.rtems.com/license/LICENSE.
+#
+
+This is a simple test that verifies that each of the smp
+processors can run a task. The init task creates and starts
+a test_task for each prcessor. With a small delay between
+the start of each processor to allow for the processor to
+print its status. Note: This may need to change to a semaphore
+locked print routine at some point in the furture.
+
+After the tasks have been started the init task waits for flags
+to be set by each task indicating that they are running. Once all
+flags are set the program terminates.
diff --git a/testsuites/smptests/smp01/smp01.scn b/testsuites/smptests/smp01/smp01.scn
new file mode 100644
index 0000000000..8d54499f3b
--- /dev/null
+++ b/testsuites/smptests/smp01/smp01.scn
@@ -0,0 +1,8 @@
+*** SMP01 TEST ***
+CPU 0 start task TA1
+CPU 1 running Task TA1
+CPU 0 start task TA2
+CPU 2 running Task TA2
+CPU 0 start task TA3
+CPU 3 running Task TA3
+*** END OF SMP 01 TEST ***
diff --git a/testsuites/smptests/smp01/system.h b/testsuites/smptests/smp01/system.h
new file mode 100644
index 0000000000..ee130a6065
--- /dev/null
+++ b/testsuites/smptests/smp01/system.h
@@ -0,0 +1,54 @@
+/*
+ * COPYRIGHT (c) 1989-2011.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#include "tmacros.h"
+#include "test_support.h"
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Test_task(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+
+#define CONFIGURE_SMP_APPLICATION
+#define CONFIGURE_SMP_MAXIMUM_PROCESSORS 4
+
+#define CONFIGURE_MAXIMUM_TASKS \
+ (1 + CONFIGURE_SMP_MAXIMUM_PROCESSORS)
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#include <rtems/confdefs.h>
+
+/* global variables */
+
+/*
+ * Keep the names and IDs in global variables so another task can use them.
+ */
+
+TEST_EXTERN volatile bool TaskRan[ CONFIGURE_SMP_MAXIMUM_PROCESSORS ];
+
+void Loop( void );
+
+/*
+ * Handy macros and static inline functions
+ */
+
+/* end of include file */
diff --git a/testsuites/smptests/smp01/tasks.c b/testsuites/smptests/smp01/tasks.c
new file mode 100644
index 0000000000..d57037a423
--- /dev/null
+++ b/testsuites/smptests/smp01/tasks.c
@@ -0,0 +1,45 @@
+/*
+ * COPYRIGHT (c) 1989-2011.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "system.h"
+
+rtems_task Test_task(
+ rtems_task_argument task_index
+)
+{
+ int cpu_num;
+ char name[5];
+ char *p;
+
+ /* Get the task name */
+ p = rtems_object_get_name( RTEMS_SELF, 5, name );
+ rtems_test_assert( p != NULL );
+
+ /* Get the CPU Number */
+ cpu_num = bsp_smp_processor_id();
+
+ /* Print that the task is up and running. */
+ Loop();
+ locked_printf(" CPU %d running Task %s\n", cpu_num, name);
+
+ /* Set the flag that the task is up and running */
+ TaskRan[cpu_num] = true;
+
+
+ /* Drop into a loop which will keep this task on
+ * running on the cpu.
+ */
+ while(1);
+}
diff --git a/testsuites/smptests/smp02/.cvsignore b/testsuites/smptests/smp02/.cvsignore
new file mode 100644
index 0000000000..282522db03
--- /dev/null
+++ b/testsuites/smptests/smp02/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/testsuites/smptests/smp02/Makefile.am b/testsuites/smptests/smp02/Makefile.am
new file mode 100644
index 0000000000..01ae429605
--- /dev/null
+++ b/testsuites/smptests/smp02/Makefile.am
@@ -0,0 +1,29 @@
+##
+## $Id$
+##
+
+MANAGERS = all
+
+rtems_tests_PROGRAMS = smp02
+smp02_SOURCES = init.c tasks.c system.h ../../support/src/locked_print.c
+
+dist_rtems_tests_DATA = smp02.scn
+dist_rtems_tests_DATA += smp02.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+AM_CPPFLAGS += -DSMPTEST
+
+smp02_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel)
+
+LINK_OBJS = $(smp02_OBJECTS) $(smp02_LDADD)
+LINK_LIBS = $(smp02_LDLIBS)
+
+smp02$(EXEEXT): $(smp02_OBJECTS) $(smp02_DEPENDENCIES)
+ @rm -f smp02$(EXEEXT)
+ $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/smptests/smp02/init.c b/testsuites/smptests/smp02/init.c
new file mode 100644
index 0000000000..ad9974a0a7
--- /dev/null
+++ b/testsuites/smptests/smp02/init.c
@@ -0,0 +1,102 @@
+/*
+ * COPYRIGHT (c) 1989-2011.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#define CONFIGURE_INIT
+#include "system.h"
+
+#include <stdio.h>
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ int i;
+ char ch;
+ int cpu_num;
+ rtems_id id;
+ rtems_status_code status;
+ char str[80];
+
+ locked_print_initialize();
+ locked_printf( "\n\n*** SMP02 TEST ***\n" );
+
+ /* Create/verify synchronisation semaphore */
+ status = rtems_semaphore_create(
+ rtems_build_name ('S', 'E', 'M', '1'),
+ 1,
+ RTEMS_LOCAL |
+ RTEMS_SIMPLE_BINARY_SEMAPHORE |
+ RTEMS_PRIORITY,
+ 1,
+ &Semaphore);
+ directive_failed( status, "rtems_semaphore_create" );
+
+ /* Lock semaphore */
+ status = rtems_semaphore_obtain( Semaphore, RTEMS_WAIT, 0);
+ directive_failed( status,"rtems_semaphore_obtain of SEM1\n");
+
+ for ( i=1; i < CONFIGURE_SMP_MAXIMUM_PROCESSORS; i++ ){
+
+ /* Create and start tasks for each CPU */
+ ch = '0' + i;
+
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'A', ch, ' ' ),
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+
+ cpu_num = bsp_smp_processor_id();
+ locked_printf(" CPU %d start task TA%c\n", cpu_num, ch);
+ status = rtems_task_start( id, Test_task, i+1 );
+ locked_printf(str, "rtems_task_start TA%d", i+1);
+ directive_failed( status, str );
+ }
+
+ /*
+ * Release the semaphore, allowing the blocked tasks to start.
+ */
+ status = rtems_semaphore_release( Semaphore );
+ directive_failed( status,"rtems_semaphore_release of SEM1\n");
+
+
+ /*
+ * Wait for log full. print the log and end the program.
+ */
+ while (Log_index < LOG_SIZE)
+ ;
+
+ for (i=0; i< LOG_SIZE; i++) {
+ if ( Log[i].IsLocked ) {
+ locked_printf(
+ " CPU %d Task TA%" PRIu32 " Obtain\n",
+ Log[i].cpu_num,
+ Log[i].task_index
+ );
+ } else {
+ locked_printf(
+ " CPU %d Task TA%" PRIu32 " Release\n",
+ Log[i].cpu_num,
+ Log[i].task_index
+ );
+ }
+ }
+
+ locked_printf( "*** END OF TEST SMP02 ***\n" );
+ rtems_test_exit( 0 );
+}
diff --git a/testsuites/smptests/smp02/smp02.doc b/testsuites/smptests/smp02/smp02.doc
new file mode 100644
index 0000000000..d4cae09976
--- /dev/null
+++ b/testsuites/smptests/smp02/smp02.doc
@@ -0,0 +1,19 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989-1999.
+# On-Line Applications Research Corporation (OAR).
+#
+# The license and distribution terms for this file may be
+# found in the file LICENSE in this distribution or at
+# http://www.rtems.com/license/LICENSE.
+#
+This test creates tasks for each process (other than the
+one that Init is running on). Then drops into a loop waiting
+on a log file to fill up. Once the log file is filled the
+information is printed and the program ends.
+
+Each task poll for a semaphore. Once the semaphore is
+obtained , a log the obtain and release is recorded and
+the semaphore is released. If the log is full the semaphore
+is released without changing the log.
diff --git a/testsuites/smptests/smp02/smp02.scn b/testsuites/smptests/smp02/smp02.scn
new file mode 100644
index 0000000000..e22387cc4e
--- /dev/null
+++ b/testsuites/smptests/smp02/smp02.scn
@@ -0,0 +1,25 @@
+*** SMP02 TEST ***
+ CPU 0 start task TA1
+ CPU 0 start task TA2
+ CPU 0 start task TA3
+ CPU 1 Task TA2 Obtain
+ CPU 1 Task TA2 Release
+ CPU 1 Task TA2 Obtain
+ CPU 1 Task TA2 Release
+ CPU 3 Task TA4 Obtain
+ CPU 3 Task TA4 Release
+ CPU 1 Task TA2 Obtain
+ CPU 1 Task TA2 Release
+ CPU 3 Task TA4 Obtain
+ CPU 3 Task TA4 Release
+ CPU 1 Task TA2 Obtain
+ CPU 1 Task TA2 Release
+ CPU 2 Task TA3 Obtain
+ CPU 2 Task TA3 Release
+ CPU 3 Task TA4 Obtain
+ CPU 3 Task TA4 Release
+ CPU 1 Task TA2 Obtain
+ CPU 1 Task TA2 Release
+ CPU 2 Task TA3 Obtain
+ CPU 2 Task TA3 Release
+*** END OF SMP 02 TEST ***
diff --git a/testsuites/smptests/smp02/system.h b/testsuites/smptests/smp02/system.h
new file mode 100644
index 0000000000..d651991c3c
--- /dev/null
+++ b/testsuites/smptests/smp02/system.h
@@ -0,0 +1,73 @@
+/*
+ * COPYRIGHT (c) 1989-2011.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#include "tmacros.h"
+#include "test_support.h"
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Test_task(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+
+#define CONFIGURE_SMP_APPLICATION
+#define CONFIGURE_SMP_MAXIMUM_PROCESSORS 4
+
+#define CONFIGURE_MAXIMUM_TASKS \
+ (1 + CONFIGURE_SMP_MAXIMUM_PROCESSORS)
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+#define CONFIGURE_INIT_TASK_STACK_SIZE \
+ (3 * CONFIGURE_MINIMUM_TASK_STACK_SIZE)
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_MAXIMUM_SEMAPHORES 1
+
+#include <rtems/confdefs.h>
+
+
+/* global variables */
+
+/*
+ * Keep the names and IDs in global variables so another task can use them.
+ */
+
+typedef struct {
+ bool IsLocked;
+ int cpu_num;
+ uint32_t task_index;
+} Log_t;
+
+#define LOG_SIZE 20
+
+TEST_EXTERN rtems_id Semaphore; /* synchronisation semaphore */
+TEST_EXTERN Log_t Log[LOG_SIZE]; /* A log of locks/unlocks */
+TEST_EXTERN volatile uint32_t Log_index; /* Index into log */
+
+/*
+ * Handy macros and static inline functions
+ */
+
+/*
+ * Macro to hide the ugliness of printing the time.
+ */
+
+/* end of include file */
diff --git a/testsuites/smptests/smp02/tasks.c b/testsuites/smptests/smp02/tasks.c
new file mode 100644
index 0000000000..01b24c472e
--- /dev/null
+++ b/testsuites/smptests/smp02/tasks.c
@@ -0,0 +1,63 @@
+/*
+ * COPYRIGHT (c) 1989-2011.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "system.h"
+
+void Loop() {
+ volatile int i;
+
+ for (i=0; i<300000; i++);
+}
+
+void LogSemaphore(
+ bool obtained,
+ int cpu_num,
+ uint32_t task_index
+){
+ int i;
+
+ if (Log_index < LOG_SIZE) {
+ /* Log the information */
+ Log[ Log_index ].IsLocked = obtained;
+ Log[ Log_index ].cpu_num = cpu_num;
+ Log[ Log_index ].task_index = task_index;
+ Log_index++;
+ }
+}
+
+rtems_task Test_task(
+ rtems_task_argument task_index
+)
+{
+ int cpu_num;
+ rtems_status_code sc;
+
+ cpu_num = bsp_smp_processor_id();
+
+ do {
+
+ /* Poll to obtain the synchronization semaphore */
+ do {
+ sc = rtems_semaphore_obtain( Semaphore, RTEMS_NO_WAIT, 0 );
+ } while (sc != RTEMS_SUCCESSFUL );
+
+ LogSemaphore(true, cpu_num, task_index);
+ LogSemaphore(false, cpu_num, task_index);
+
+ rtems_semaphore_release( Semaphore );
+ }
+
+ while(1);
+}
diff --git a/testsuites/smptests/smp03/.cvsignore b/testsuites/smptests/smp03/.cvsignore
new file mode 100644
index 0000000000..282522db03
--- /dev/null
+++ b/testsuites/smptests/smp03/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/testsuites/smptests/smp03/Makefile.am b/testsuites/smptests/smp03/Makefile.am
new file mode 100644
index 0000000000..d3483b9ef4
--- /dev/null
+++ b/testsuites/smptests/smp03/Makefile.am
@@ -0,0 +1,29 @@
+##
+## $Id$
+##
+
+MANAGERS = all
+
+rtems_tests_PROGRAMS = smp03
+smp03_SOURCES = init.c tasks.c system.h ../../support/src/locked_print.c
+
+dist_rtems_tests_DATA = smp03.scn
+dist_rtems_tests_DATA += smp03.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+AM_CPPFLAGS += -DSMPTEST
+
+smp03_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel)
+
+LINK_OBJS = $(smp03_OBJECTS) $(smp03_LDADD)
+LINK_LIBS = $(smp03_LDLIBS)
+
+smp03$(EXEEXT): $(smp03_OBJECTS) $(smp03_DEPENDENCIES)
+ @rm -f smp03$(EXEEXT)
+ $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/smptests/smp03/init.c b/testsuites/smptests/smp03/init.c
new file mode 100644
index 0000000000..060371b9d5
--- /dev/null
+++ b/testsuites/smptests/smp03/init.c
@@ -0,0 +1,94 @@
+/*
+ * COPYRIGHT (c) 1989-2011.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#define CONFIGURE_INIT
+#include "system.h"
+
+#include <stdio.h>
+
+void Loop() {
+ volatile int i;
+
+ for (i=0; i<300000; i++);
+}
+
+void PrintTaskInfo(
+ const char *task_name
+)
+{
+ int cpu_num;
+ rtems_status_code sc;
+
+ cpu_num = bsp_smp_processor_id();
+
+ locked_printf(" CPU %d running task %s\n", cpu_num, task_name );
+}
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ int i;
+ char ch;
+ rtems_id id;
+ rtems_status_code status;
+
+ Loop();
+ locked_print_initialize();
+
+ locked_printf( "\n\n*** SMP03 TEST ***" );
+
+
+ /* Show that the init task is running on this cpu */
+ PrintTaskInfo( "Init" );
+
+ /* for each remaining cpu create and start a task */
+ for ( i=1; i < CONFIGURE_SMP_MAXIMUM_PROCESSORS; i++ ){
+
+ ch = '0' + i;
+
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'A', ch, ' ' ),
+ CONFIGURE_INIT_TASK_PRIORITY + (2*i),
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_PREEMPT,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ status = rtems_task_start( id, Test_task, i );
+
+ Loop();
+ }
+
+ /* Create/Start an aditional task with the highest priority */
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'A', ch, ' ' ),
+ 3,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_PREEMPT,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ TestFinished = false;
+ status = rtems_task_start( id, Test_task, CONFIGURE_SMP_MAXIMUM_PROCESSORS );
+
+ /* Wait on the last task to run */
+ while(!TestFinished)
+ ;
+
+ /* End the test */
+ locked_printf( "*** END OF TEST SMP03 ***" );
+ rtems_test_exit( 0 );
+}
diff --git a/testsuites/smptests/smp03/smp03.doc b/testsuites/smptests/smp03/smp03.doc
new file mode 100644
index 0000000000..1349199496
--- /dev/null
+++ b/testsuites/smptests/smp03/smp03.doc
@@ -0,0 +1,19 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989-1999.
+# On-Line Applications Research Corporation (OAR).
+#
+# The license and distribution terms for this file may be
+# found in the file LICENSE in this distribution or at
+# http://www.rtems.com/license/LICENSE.
+#
+This test runs the init task on the first CPU at a priority
+of 5. The Init task creates tasks for each remaining processor
+at priorities ( 5 + (2*CPU) ). It then creates one more
+task at a priority of 3 wich should preempt the last task created.
+The Init task waits on the last task to run then ends the program.
+
+Each created task prints the cpu and task that it is running. Then
+checkes the task id to see if it is the final task. If it is the
+final task, a flag is set for the Init task to see.
diff --git a/testsuites/smptests/smp03/smp03.scn b/testsuites/smptests/smp03/smp03.scn
new file mode 100644
index 0000000000..513d400d0d
--- /dev/null
+++ b/testsuites/smptests/smp03/smp03.scn
@@ -0,0 +1,7 @@
+*** SMP03 TEST ***
+ CPU 0 running task Init
+ CPU 1 running task TA1
+ CPU 2 running task TA2
+ CPU 3 running task TA3
+ CPU 3 running task TA4
+*** END OF SMP03 TEST ***
diff --git a/testsuites/smptests/smp03/system.h b/testsuites/smptests/smp03/system.h
new file mode 100644
index 0000000000..1161d74b8d
--- /dev/null
+++ b/testsuites/smptests/smp03/system.h
@@ -0,0 +1,68 @@
+/*
+ * COPYRIGHT (c) 1989-2011.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#include "tmacros.h"
+#include "test_support.h"
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Test_task(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+
+#define CONFIGURE_SMP_APPLICATION
+#define CONFIGURE_SMP_MAXIMUM_PROCESSORS 4
+
+#define CONFIGURE_MAXIMUM_TASKS \
+ (1 + CONFIGURE_SMP_MAXIMUM_PROCESSORS)
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+#define CONFIGURE_INIT_TASK_STACK_SIZE \
+ (3 * CONFIGURE_MINIMUM_TASK_STACK_SIZE)
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_INIT_TASK_PRIORITY 5
+#define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_PREEMPT
+
+#include <rtems/confdefs.h>
+
+
+/* global variables */
+
+/*
+ * Keep the names and IDs in global variables so another task can use them.
+ */
+void Loop(void);
+void PrintTaskInfo(
+ const char *task_name
+);
+
+TEST_EXTERN volatile bool TestFinished;
+
+/*
+ * Handy macros and static inline functions
+ */
+
+/*
+ * Macro to hide the ugliness of printing the time.
+ */
+
+/* end of include file */
diff --git a/testsuites/smptests/smp03/tasks.c b/testsuites/smptests/smp03/tasks.c
new file mode 100644
index 0000000000..d609596d3f
--- /dev/null
+++ b/testsuites/smptests/smp03/tasks.c
@@ -0,0 +1,38 @@
+/*
+ * COPYRIGHT (c) 1989-2011.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "system.h"
+
+rtems_task Test_task(
+ rtems_task_argument task_index
+)
+{
+ char task_name[5];
+
+ /* Show that this task is running on cpu X */
+ sprintf( task_name, "TA%" PRIu32, task_index );
+ PrintTaskInfo( task_name );
+
+ /* If this is the last task created set a flag for the
+ * test to end.
+ */
+ if ( task_index == CONFIGURE_SMP_MAXIMUM_PROCESSORS ) {
+ TestFinished = true;
+ }
+
+ /* Wait for the test to end without giving up this processor */
+ while(1)
+ ;
+}
diff --git a/testsuites/smptests/smp04/.cvsignore b/testsuites/smptests/smp04/.cvsignore
new file mode 100644
index 0000000000..282522db03
--- /dev/null
+++ b/testsuites/smptests/smp04/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/testsuites/smptests/smp04/Makefile.am b/testsuites/smptests/smp04/Makefile.am
new file mode 100644
index 0000000000..80f2968dc5
--- /dev/null
+++ b/testsuites/smptests/smp04/Makefile.am
@@ -0,0 +1,29 @@
+##
+## $Id$
+##
+
+MANAGERS = all
+
+rtems_tests_PROGRAMS = smp04
+smp04_SOURCES = init.c tasks.c system.h ../../support/src/locked_print.c
+
+dist_rtems_tests_DATA = smp04.scn
+dist_rtems_tests_DATA += smp04.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+AM_CPPFLAGS += -DSMPTEST
+
+smp04_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel)
+
+LINK_OBJS = $(smp04_OBJECTS) $(smp04_LDADD)
+LINK_LIBS = $(smp04_LDLIBS)
+
+smp04$(EXEEXT): $(smp04_OBJECTS) $(smp04_DEPENDENCIES)
+ @rm -f smp04$(EXEEXT)
+ $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/smptests/smp04/init.c b/testsuites/smptests/smp04/init.c
new file mode 100644
index 0000000000..3bbe28cb38
--- /dev/null
+++ b/testsuites/smptests/smp04/init.c
@@ -0,0 +1,119 @@
+/*
+ * COPYRIGHT (c) 1989-2011.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#define CONFIGURE_INIT
+#include "system.h"
+
+#include <stdio.h>
+
+
+void Loop() {
+ volatile int i;
+
+ for (i=0; i<500000; i++);
+}
+
+void PrintTaskInfo(
+ const char *task_name
+)
+{
+ int cpu_num;
+
+ cpu_num = bsp_smp_processor_id();
+
+ locked_printf(" CPU %d running task %s\n", cpu_num, task_name );
+}
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ int i;
+ char ch;
+ rtems_id id;
+ rtems_status_code status;
+ bool allDone;
+
+ Loop();
+ locked_print_initialize();
+ locked_printf( "\n\n*** SMP04 TEST ***\n" );
+
+ PrintTaskInfo( "Init" );
+
+ TaskRan[0] = true;
+ for ( i=1; i <= rtems_smp_get_number_of_processors() ; i++ )
+ TaskRan[i] = false;
+
+ for ( i=1; i < rtems_smp_get_number_of_processors() ; i++ ){
+
+ /* Create and start tasks for each CPU */
+ ch = '0' + i;
+ locked_printf(
+ "Create a TA%c a %s task\n",
+ ch,
+ ((i%2) ? "RTEMS_PREEMPT" : "RTEMS_NO_PREEMPT" )
+ );
+
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'A', ch, ' ' ),
+ CONFIGURE_INIT_TASK_PRIORITY +
+ (2*rtems_smp_get_number_of_processors()) - (2*i),
+ RTEMS_MINIMUM_STACK_SIZE,
+ ((i%2) ? RTEMS_PREEMPT : RTEMS_NO_PREEMPT),
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ }
+
+ for ( i=1; i < rtems_smp_get_number_of_processors() ; i++ ){
+ status = rtems_task_start( id, Test_task, i );
+
+ /* Force a wait on the task to run in order to synchronize on
+ * simulated systems.
+ */
+ while (TaskRan[i] == false)
+ ;
+ }
+
+ ch = '0' + rtems_smp_get_number_of_processors() ;
+
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'A', ch, ' ' ),
+ 3,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_PREEMPT,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ status = rtems_task_start(
+ id,
+ Test_task,
+ rtems_smp_get_number_of_processors()
+ );
+
+ /* Wait on the all tasks to run */
+ while (1) {
+ allDone = true;
+ for ( i=1; i<=rtems_smp_get_number_of_processors() ; i++ ) {
+ if (TaskRan[i] == false)
+ allDone = false;
+ }
+ if (allDone) {
+ Loop();
+ locked_printf( "*** END OF TEST SMP04 ***" );
+ rtems_test_exit( 0 );
+ }
+ }
+}
diff --git a/testsuites/smptests/smp04/smp04.doc b/testsuites/smptests/smp04/smp04.doc
new file mode 100644
index 0000000000..0f347bb038
--- /dev/null
+++ b/testsuites/smptests/smp04/smp04.doc
@@ -0,0 +1,17 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989-1999.
+# On-Line Applications Research Corporation (OAR).
+#
+# The license and distribution terms for this file may be
+# found in the file LICENSE in this distribution or at
+# http://www.rtems.com/license/LICENSE.
+#
+This test startst Init task with priority 5 and preemption on which
+runs on CPU 0. The init task alternates preemption off and preemtion
+on as it creates tasks for every other cpu in the system. The priority
+of task N will be 5 + 2; task N-1 will be 5 + 4 .....
+Another task will be created after tasks are running on all cpus. This
+task will be of a priority 3. For a 4 cpu system this task should run
+on cpu 2. For a 2 cpu system the task should preempt the Init task.
diff --git a/testsuites/smptests/smp04/smp04.scn b/testsuites/smptests/smp04/smp04.scn
new file mode 100644
index 0000000000..a6c775cc50
--- /dev/null
+++ b/testsuites/smptests/smp04/smp04.scn
@@ -0,0 +1,8 @@
+*** SMP04 TEST ***
+ CPU 0 running task Init
+ CPU 1 running task TA1
+ CPU 2 running task TA2
+ CPU 3 running task TA3
+ CPU 2 running task TA4
+*** END OF SMP 04 TEST ***
+
diff --git a/testsuites/smptests/smp04/system.h b/testsuites/smptests/smp04/system.h
new file mode 100644
index 0000000000..ae7a254fac
--- /dev/null
+++ b/testsuites/smptests/smp04/system.h
@@ -0,0 +1,70 @@
+/*
+ * COPYRIGHT (c) 1989-2011.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#include "tmacros.h"
+#include "test_support.h"
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Test_task(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+
+#define CONFIGURE_SMP_APPLICATION
+#define CONFIGURE_SMP_MAXIMUM_PROCESSORS 4
+
+#define CONFIGURE_MAXIMUM_TASKS \
+ (1 + CONFIGURE_SMP_MAXIMUM_PROCESSORS)
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+#define CONFIGURE_INIT_TASK_STACK_SIZE \
+ (3 * CONFIGURE_MINIMUM_TASK_STACK_SIZE)
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_INIT_TASK_PRIORITY 5
+#define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_NO_PREEMPT
+
+#define CONFIGURE_MAXIMUM_SEMAPHORES 1
+
+#include <rtems/confdefs.h>
+
+
+/* global variables */
+
+/*
+ * Keep the names and IDs in global variables so another task can use them.
+ */
+void Loop(void);
+void PrintTaskInfo(
+ const char *task_name
+);
+
+TEST_EXTERN volatile bool TaskRan[ CONFIGURE_SMP_MAXIMUM_PROCESSORS ];
+
+/*
+ * Handy macros and static inline functions
+ */
+
+/*
+ * Macro to hide the ugliness of printing the time.
+ */
+
+/* end of include file */
diff --git a/testsuites/smptests/smp04/tasks.c b/testsuites/smptests/smp04/tasks.c
new file mode 100644
index 0000000000..a8b96cf688
--- /dev/null
+++ b/testsuites/smptests/smp04/tasks.c
@@ -0,0 +1,31 @@
+/*
+ * COPYRIGHT (c) 1989-2011.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "system.h"
+
+rtems_task Test_task(
+ rtems_task_argument task_index
+)
+{
+ char task_name[5];
+
+ sprintf(task_name, "TA%" PRIu32, task_index );
+ PrintTaskInfo( task_name );
+
+ Loop();
+ TaskRan[task_index] = true;
+
+ while(1);
+}
diff --git a/testsuites/smptests/smp05/.cvsignore b/testsuites/smptests/smp05/.cvsignore
new file mode 100644
index 0000000000..282522db03
--- /dev/null
+++ b/testsuites/smptests/smp05/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/testsuites/smptests/smp05/Makefile.am b/testsuites/smptests/smp05/Makefile.am
new file mode 100644
index 0000000000..dfb6483488
--- /dev/null
+++ b/testsuites/smptests/smp05/Makefile.am
@@ -0,0 +1,27 @@
+##
+## $Id$
+##
+
+MANAGERS = all
+
+rtems_tests_PROGRAMS = smp05
+smp05_SOURCES = init.c ../../support/src/locked_print.c
+
+dist_rtems_tests_DATA = smp05.scn
+dist_rtems_tests_DATA += smp05.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+AM_CPPFLAGS += -DSMPTEST
+
+LINK_OBJS = $(smp05_OBJECTS) $(smp05_LDADD)
+LINK_LIBS = $(smp05_LDLIBS)
+
+smp05$(EXEEXT): $(smp05_OBJECTS) $(smp05_DEPENDENCIES)
+ @rm -f smp05$(EXEEXT)
+ $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/smptests/smp05/init.c b/testsuites/smptests/smp05/init.c
new file mode 100644
index 0000000000..f2307246a1
--- /dev/null
+++ b/testsuites/smptests/smp05/init.c
@@ -0,0 +1,76 @@
+/*
+ * COPYRIGHT (c) 1989-2011.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+#include "test_support.h"
+
+rtems_task Test_task(
+ rtems_task_argument argument
+)
+{
+ locked_printf( "Shut down from CPU %d\n", bsp_smp_processor_id() );
+ locked_printf( "*** END OF TEST SMP05 ***" );
+ rtems_test_exit(0);
+}
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ int i;
+ char ch;
+ int cpu_num;
+ rtems_id id;
+ rtems_status_code status;
+
+ locked_print_initialize();
+ locked_printf( "\n\n*** TEST SMP05 ***\n" );
+
+ for ( i=0; i<rtems_smp_get_number_of_processors() ; i++ ) {
+ ch = '1' + i;
+
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'A', ch, ' ' ),
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ directive_failed( status, "task create" );
+
+ cpu_num = bsp_smp_processor_id();
+ locked_printf(" CPU %d start task TA%c\n", cpu_num, ch);
+
+ status = rtems_task_start( id, Test_task, i+1 );
+ directive_failed( status, "task start" );
+ }
+
+ while (1)
+ ;
+}
+
+/* configuration information */
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
+
+#define CONFIGURE_SMP_APPLICATION
+#define CONFIGURE_SMP_MAXIMUM_PROCESSORS 2
+
+#define CONFIGURE_MAXIMUM_TASKS \
+ (1 + CONFIGURE_SMP_MAXIMUM_PROCESSORS)
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_INIT
+
+#include <rtems/confdefs.h>
+/* end of file */
diff --git a/testsuites/smptests/smp05/smp05.doc b/testsuites/smptests/smp05/smp05.doc
new file mode 100644
index 0000000000..bd588b70bc
--- /dev/null
+++ b/testsuites/smptests/smp05/smp05.doc
@@ -0,0 +1,22 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989-2010.
+# On-Line Applications Research Corporation (OAR).
+#
+# The license and distribution terms for this file may be
+# found in the file LICENSE in this distribution or at
+# http://www.rtems.com/license/LICENSE.
+#
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: smp05
+
+directives:
+
+ XXX list them
+
+concepts:
+
++ XXX list them
diff --git a/testsuites/smptests/smp05/smp05.scn b/testsuites/smptests/smp05/smp05.scn
new file mode 100644
index 0000000000..fb985c2fbd
--- /dev/null
+++ b/testsuites/smptests/smp05/smp05.scn
@@ -0,0 +1,5 @@
+*** TEST SMP05 ***
+ CPU 0 start task TA1
+ CPU 0 start task TA2
+Shut down from CPU 1
+*** END OF TEST SMP05 ***
diff --git a/testsuites/smptests/smp06/.cvsignore b/testsuites/smptests/smp06/.cvsignore
new file mode 100644
index 0000000000..282522db03
--- /dev/null
+++ b/testsuites/smptests/smp06/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/testsuites/smptests/smp06/Makefile.am b/testsuites/smptests/smp06/Makefile.am
new file mode 100644
index 0000000000..5c88d2ffc5
--- /dev/null
+++ b/testsuites/smptests/smp06/Makefile.am
@@ -0,0 +1,27 @@
+##
+## $Id$
+##
+
+MANAGERS = all
+
+rtems_tests_PROGRAMS = smp06
+smp06_SOURCES = init.c ../../support/src/locked_print.c
+
+dist_rtems_tests_DATA = smp06.scn
+dist_rtems_tests_DATA += smp06.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+AM_CPPFLAGS += -DSMPTEST
+
+LINK_OBJS = $(smp06_OBJECTS) $(smp06_LDADD)
+LINK_LIBS = $(smp06_LDLIBS)
+
+smp06$(EXEEXT): $(smp06_OBJECTS) $(smp06_DEPENDENCIES)
+ @rm -f smp06$(EXEEXT)
+ $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/smptests/smp06/init.c b/testsuites/smptests/smp06/init.c
new file mode 100644
index 0000000000..0514385e61
--- /dev/null
+++ b/testsuites/smptests/smp06/init.c
@@ -0,0 +1,124 @@
+/*
+ * COPYRIGHT (c) 1989-2011.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+#include "test_support.h"
+
+volatile bool Ran;
+
+rtems_task Test_task(
+ rtems_task_argument do_exit
+)
+{
+ int cpu_num;
+ char name[5];
+ char *p;
+
+ p = rtems_object_get_name( RTEMS_SELF, 5, name );
+ rtems_test_assert( p != NULL );
+
+ cpu_num = bsp_smp_processor_id();
+ locked_printf(" CPU %d running Task %s\n", cpu_num, name);
+
+ Ran = true;
+
+ if ( do_exit ) {
+ locked_printf( "*** END OF TEST SMP06 ***" );
+ rtems_test_exit(0);
+ }
+ while(1)
+ ;
+}
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ int i;
+ char ch;
+ int cpu_num;
+ rtems_id id;
+ rtems_status_code status;
+
+ locked_print_initialize();
+ locked_printf( "\n\n*** TEST SMP06 ***\n" );
+ locked_printf( "rtems_clock_tick - so this task has run longer\n" );
+ status = rtems_clock_tick();
+ directive_failed( status, "clock tick" );
+
+ rtems_test_assert( rtems_smp_get_number_of_processors() > 1 );
+
+ cpu_num = bsp_smp_processor_id();
+
+ /*
+ * Create a task at equal priority.
+ */
+ Ran = false;
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'A', '1', ' ' ),
+ 2,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_PREEMPT,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ directive_failed( status, "task create" );
+
+ locked_printf(" CPU %d start task TA1\n", cpu_num );
+
+ status = rtems_task_start( id, Test_task, 0 );
+ directive_failed( status, "task start" );
+
+ while ( Ran == false )
+ ;
+
+ /*
+ * Create a task at greater priority.
+ */
+ Ran = false;
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'A', '2', ' ' ),
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_PREEMPT,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ directive_failed( status, "task create" );
+
+ cpu_num = bsp_smp_processor_id();
+ locked_printf(" CPU %d start task TA2\n", cpu_num );
+
+ status = rtems_task_start( id, Test_task, 1 );
+ directive_failed( status, "task start" );
+
+ while ( 1 )
+ ;
+}
+
+/* configuration information */
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
+
+#define CONFIGURE_SMP_APPLICATION
+#define CONFIGURE_SMP_MAXIMUM_PROCESSORS 2
+
+#define CONFIGURE_MAXIMUM_TASKS 4
+
+#define CONFIGURE_INIT_TASK_PRIORITY 2
+#define CONFIGURE_INIT_TASK_MODES RTEMS_PREEMPT
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_INIT
+
+#include <rtems/confdefs.h>
+/* end of file */
diff --git a/testsuites/smptests/smp06/smp06.doc b/testsuites/smptests/smp06/smp06.doc
new file mode 100644
index 0000000000..beb404b853
--- /dev/null
+++ b/testsuites/smptests/smp06/smp06.doc
@@ -0,0 +1,25 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989-2011.
+# On-Line Applications Research Corporation (OAR).
+#
+# The license and distribution terms for this file may be
+# found in the file LICENSE in this distribution or at
+# http://www.rtems.com/license/LICENSE.
+#
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: smp06
+
+directives:
+
+ rtems_task_create
+ rtems_task_start
+
+concepts:
+
++ Ensure that in an SMP system, when given a choice to preempt one of two
+ threads at equal priority, the thread which has been running the longest
+ is selected.
diff --git a/testsuites/smptests/smp06/smp06.scn b/testsuites/smptests/smp06/smp06.scn
new file mode 100644
index 0000000000..3610c77e43
--- /dev/null
+++ b/testsuites/smptests/smp06/smp06.scn
@@ -0,0 +1,7 @@
+** TEST SMP06 ***
+rtems_clock_tick - so this task has run longer
+ CPU 0 start task TA1
+ CPU 1 running Task TA1
+ CPU 0 start task TA2
+ CPU 1 running Task TA2
+*** END OF TEST SMP06 ***
diff --git a/testsuites/smptests/smp07/.cvsignore b/testsuites/smptests/smp07/.cvsignore
new file mode 100644
index 0000000000..282522db03
--- /dev/null
+++ b/testsuites/smptests/smp07/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/testsuites/smptests/smp07/Makefile.am b/testsuites/smptests/smp07/Makefile.am
new file mode 100644
index 0000000000..de140d87bf
--- /dev/null
+++ b/testsuites/smptests/smp07/Makefile.am
@@ -0,0 +1,27 @@
+##
+## $Id$
+##
+
+MANAGERS = all
+
+rtems_tests_PROGRAMS = smp07
+smp07_SOURCES = init.c ../../support/src/locked_print.c
+
+dist_rtems_tests_DATA = smp07.scn
+dist_rtems_tests_DATA += smp07.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+AM_CPPFLAGS += -DSMPTEST
+
+LINK_OBJS = $(smp07_OBJECTS) $(smp07_LDADD)
+LINK_LIBS = $(smp07_LDLIBS)
+
+smp07$(EXEEXT): $(smp07_OBJECTS) $(smp07_DEPENDENCIES)
+ @rm -f smp07$(EXEEXT)
+ $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/smptests/smp07/init.c b/testsuites/smptests/smp07/init.c
new file mode 100644
index 0000000000..727bc15536
--- /dev/null
+++ b/testsuites/smptests/smp07/init.c
@@ -0,0 +1,164 @@
+/*
+ * COPYRIGHT (c) 1989-2011.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+#include "test_support.h"
+
+volatile bool TaskRan = false;
+volatile bool TSRFired = false;
+rtems_id Semaphore;
+
+rtems_task Test_task(
+ rtems_task_argument argument
+)
+{
+ int cpu_num;
+ rtems_status_code sc;
+ char name[5];
+ char *p;
+
+ /* Get the task name */
+ p = rtems_object_get_name( RTEMS_SELF, 5, name );
+ rtems_test_assert( p != NULL );
+
+ /* Get the CPU Number */
+ cpu_num = bsp_smp_processor_id();
+
+ /* Print that the task is up and running. */
+ locked_printf(" CPU %d runnng Task %s and blocking\n", cpu_num, name);
+
+ sc = rtems_semaphore_obtain( Semaphore, RTEMS_WAIT, RTEMS_NO_TIMEOUT );
+ directive_failed( sc,"obtain in test task");
+
+ if ( !TSRFired )
+ locked_printf( "*** ERROR TSR DID NOT FIRE BUT TEST TASK AWAKE***" );
+
+ TaskRan = true;
+
+ /* Print that the task is up and running. */
+ locked_printf(" CPU %d running Task %s after semaphore release\n", cpu_num, name);
+
+ (void) rtems_task_delete( RTEMS_SELF );
+}
+
+
+rtems_timer_service_routine TimerMethod(
+ rtems_id timer,
+ void *arg
+)
+{
+ /*
+ * Set flag and release the semaphore, allowing the blocked tasks to start.
+ */
+ TSRFired = true;
+
+ rtems_semaphore_release( Semaphore );
+}
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ int cpu_num;
+ rtems_id id;
+ rtems_status_code status;
+ rtems_interval per_second;
+ rtems_interval then;
+ rtems_id Timer;
+
+ locked_print_initialize();
+ locked_printf( "\n\n*** TEST SMP07 ***\n" );
+
+ /* Create/verify semaphore */
+ status = rtems_semaphore_create(
+ rtems_build_name ('S', 'E', 'M', '1'),
+ 1,
+ RTEMS_LOCAL |
+ RTEMS_SIMPLE_BINARY_SEMAPHORE |
+ RTEMS_PRIORITY,
+ 1,
+ &Semaphore
+ );
+ directive_failed( status, "rtems_semaphore_create" );
+
+ /* Lock semaphore */
+ status = rtems_semaphore_obtain( Semaphore, RTEMS_WAIT, 0);
+ directive_failed( status,"rtems_semaphore_obtain of SEM1\n");
+
+ /* Create and Start test task. */
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'A', '1', ' ' ),
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ directive_failed( status, "task create" );
+
+ cpu_num = bsp_smp_processor_id();
+ locked_printf(" CPU %d start task TA1\n", cpu_num );
+ status = rtems_task_start( id, Test_task, 1 );
+ directive_failed( status, "task start" );
+
+ /* Create and start TSR */
+ locked_printf(" CPU %d create and start timer\n", cpu_num );
+ status = rtems_timer_create( rtems_build_name( 'T', 'M', 'R', '1' ), &Timer);
+ directive_failed( status, "rtems_timer_create" );
+
+ per_second = rtems_clock_get_ticks_per_second();
+ status = rtems_timer_fire_after( Timer, 2 * per_second, TimerMethod, NULL );
+ directive_failed( status, "rtems_timer_fire_after");
+
+ /*
+ * Wait long enough that TSR should have fired.
+ *
+ * Spin so CPU 0 is consumed. This forces task to run on CPU 1.
+ */
+ then = rtems_clock_get_ticks_since_boot() + 4 * per_second;
+ while (1) {
+ if ( rtems_clock_get_ticks_since_boot() > then )
+ break;
+ if ( TSRFired && TaskRan )
+ break;
+ };
+
+ /* Validate the timer fired and that the task ran */
+ if ( !TSRFired )
+ locked_printf( "*** ERROR TSR DID NOT FIRE ***" );
+
+ if ( !TaskRan ) {
+ locked_printf( "*** ERROR TASK DID NOT RUN ***" );
+ rtems_test_exit(0);
+ }
+
+ /* End the program */
+ locked_printf( "*** END OF TEST SMP07 ***\n" );
+ rtems_test_exit(0);
+}
+
+/* configuration information */
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_SMP_APPLICATION
+#define CONFIGURE_SMP_MAXIMUM_PROCESSORS 2
+#define CONFIGURE_MAXIMUM_TIMERS 1
+
+#define CONFIGURE_MAXIMUM_TASKS 2
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+#define CONFIGURE_MAXIMUM_SEMAPHORES 1
+
+#define CONFIGURE_INIT
+
+#include <rtems/confdefs.h>
+/* end of file */
diff --git a/testsuites/smptests/smp07/smp07.doc b/testsuites/smptests/smp07/smp07.doc
new file mode 100644
index 0000000000..89a029e76e
--- /dev/null
+++ b/testsuites/smptests/smp07/smp07.doc
@@ -0,0 +1,24 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989-2010.
+# On-Line Applications Research Corporation (OAR).
+#
+# The license and distribution terms for this file may be
+# found in the file LICENSE in this distribution or at
+# http://www.rtems.com/license/LICENSE.
+#
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: smp07
+
+directives:
+
+ rtems_semaphore_obtain
+ rtems_semaphore_release
+
+concepts:
+
++ Ensure that if a task is unblocked from an ISR on an SMP system, that
+ it will run.
diff --git a/testsuites/smptests/smp07/smp07.scn b/testsuites/smptests/smp07/smp07.scn
new file mode 100644
index 0000000000..671b29c50e
--- /dev/null
+++ b/testsuites/smptests/smp07/smp07.scn
@@ -0,0 +1,6 @@
+*** TEST SMP07 ***
+ CPU 0 start task TA1
+ CPU 0 create and start timer
+ CPU 1 runnng Task TA1 and blocking
+ CPU 1 running Task TA1 after semaphore release
+*** END OF TEST SMP07 ***
diff --git a/testsuites/smptests/smp08/.cvsignore b/testsuites/smptests/smp08/.cvsignore
new file mode 100644
index 0000000000..282522db03
--- /dev/null
+++ b/testsuites/smptests/smp08/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/testsuites/smptests/smp08/Makefile.am b/testsuites/smptests/smp08/Makefile.am
new file mode 100644
index 0000000000..5c8d735dd8
--- /dev/null
+++ b/testsuites/smptests/smp08/Makefile.am
@@ -0,0 +1,29 @@
+##
+## $Id$
+##
+
+MANAGERS = all
+
+rtems_tests_PROGRAMS = smp08
+smp08_SOURCES = init.c tasks.c system.h ../../support/src/locked_print.c
+
+dist_rtems_tests_DATA = smp08.scn
+dist_rtems_tests_DATA += smp08.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+AM_CPPFLAGS += -DSMPTEST
+
+smp08_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel)
+
+LINK_OBJS = $(smp08_OBJECTS) $(smp08_LDADD)
+LINK_LIBS = $(smp08_LDLIBS)
+
+smp08$(EXEEXT): $(smp08_OBJECTS) $(smp08_DEPENDENCIES)
+ @rm -f smp08$(EXEEXT)
+ $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/smptests/smp08/init.c b/testsuites/smptests/smp08/init.c
new file mode 100644
index 0000000000..70055be022
--- /dev/null
+++ b/testsuites/smptests/smp08/init.c
@@ -0,0 +1,97 @@
+/*
+ * COPYRIGHT (c) 1989-2011.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#define CONFIGURE_INIT
+#include "system.h"
+
+void PrintTaskInfo(
+ const char *task_name,
+ rtems_time_of_day *_tb
+)
+{
+ int cpu_num;
+ rtems_status_code sc;
+
+ cpu_num = bsp_smp_processor_id();
+
+ /* Print the cpu number and task name */
+ locked_printf(
+ " CPU %d running task %s - rtems_clock_get_tod "
+ "%02" PRId32 ":%02" PRId32 ":%02" PRId32 " %02" PRId32
+ "/%02" PRId32 "/%04" PRId32 "\n",
+ cpu_num,
+ task_name,
+ _tb->hour, _tb->minute, _tb->second,
+ _tb->month, _tb->day, _tb->year
+ );
+}
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_time_of_day time;
+ int i;
+ char ch;
+ rtems_id id;
+
+ locked_print_initialize();
+ locked_printf( "\n\n*** SMP08 TEST ***\n" );
+
+ time.year = 1988;
+ time.month = 12;
+ time.day = 31;
+ time.hour = 9;
+ time.minute = 0;
+ time.second = 0;
+ time.ticks = 0;
+
+ status = rtems_clock_set( &time );
+
+ /* Create/verify synchronisation semaphore */
+ status = rtems_semaphore_create(
+ rtems_build_name ('S', 'E', 'M', '1'),
+ 1,
+ RTEMS_LOCAL |
+ RTEMS_SIMPLE_BINARY_SEMAPHORE |
+ RTEMS_PRIORITY,
+ 1,
+ &Semaphore
+ );
+ directive_failed( status, "rtems_semaphore_create" );
+
+ /* Show that the init task is running on this cpu */
+ PrintTaskInfo( "Init", &time );
+
+ for ( i=1; i <= rtems_smp_get_number_of_processors() *3; i++ ) {
+ ch = '0' + i;
+
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'A', ch, ' ' ),
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ directive_failed( status, "task create" );
+
+ status = rtems_task_start( id, Test_task, i+1 );
+ directive_failed( status, "task start" );
+ }
+
+ status = rtems_task_delete( RTEMS_SELF );
+}
diff --git a/testsuites/smptests/smp08/smp08.doc b/testsuites/smptests/smp08/smp08.doc
new file mode 100644
index 0000000000..5c0baceb8d
--- /dev/null
+++ b/testsuites/smptests/smp08/smp08.doc
@@ -0,0 +1,12 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989-1999.
+# On-Line Applications Research Corporation (OAR).
+#
+# The license and distribution terms for this file may be
+# found in the file LICENSE in this distribution or at
+# http://www.rtems.com/license/LICENSE.
+#
+
+
diff --git a/testsuites/smptests/smp08/smp08.scn b/testsuites/smptests/smp08/smp08.scn
new file mode 100644
index 0000000000..b1a434abb6
--- /dev/null
+++ b/testsuites/smptests/smp08/smp08.scn
@@ -0,0 +1,16 @@
+*** CLOCK TICK TEST ***
+TA1 - clock_get_tod - 09:00:00 12/31/1988
+TA2 - clock_get_tod - 09:00:00 12/31/1988
+TA3 - clock_get_tod - 09:00:00 12/31/1988
+TA1 - clock_get_tod - 09:00:05 12/31/1988
+TA1 - clock_get_tod - 09:00:10 12/31/1988
+TA2 - clock_get_tod - 09:00:10 12/31/1988
+TA1 - clock_get_tod - 09:00:15 12/31/1988
+TA3 - clock_get_tod - 09:00:15 12/31/1988
+TA1 - clock_get_tod - 09:00:20 12/31/1988
+TA2 - clock_get_tod - 09:00:20 12/31/1988
+TA1 - clock_get_tod - 09:00:25 12/31/1988
+TA1 - clock_get_tod - 09:00:30 12/31/1988
+TA2 - clock_get_tod - 09:00:30 12/31/1988
+TA3 - clock_get_tod - 09:00:30 12/31/1988
+*** END OF CLOCK TICK TEST ***
diff --git a/testsuites/smptests/smp08/system.h b/testsuites/smptests/smp08/system.h
new file mode 100644
index 0000000000..f1dc23e72d
--- /dev/null
+++ b/testsuites/smptests/smp08/system.h
@@ -0,0 +1,56 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989-2009.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#include "tmacros.h"
+#include "test_support.h"
+
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+rtems_task Test_task(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#include <bsp.h> /* for device driver prototypes */
+
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+
+#define CONFIGURE_SMP_APPLICATION
+#define CONFIGURE_SMP_MAXIMUM_PROCESSORS 4
+
+#define CONFIGURE_MAXIMUM_TASKS \
+ (1 + (CONFIGURE_SMP_MAXIMUM_PROCESSORS*3) )
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+#define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE)
+#define CONFIGURE_MAXIMUM_SEMAPHORES 1
+
+#include <rtems/confdefs.h>
+
+TEST_EXTERN rtems_id Semaphore; /* synchronisation semaphore */
+
+void PrintTaskInfo(
+ const char *task_name,
+ rtems_time_of_day *_tb
+);
+
+/* end of include file */
diff --git a/testsuites/smptests/smp08/tasks.c b/testsuites/smptests/smp08/tasks.c
new file mode 100644
index 0000000000..af1219f5c6
--- /dev/null
+++ b/testsuites/smptests/smp08/tasks.c
@@ -0,0 +1,59 @@
+/* Test_task
+ *
+ * This routine serves as a test task. It verifies the basic task
+ * switching capabilities of the executive.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989-2009.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "system.h"
+
+rtems_task Test_task(
+ rtems_task_argument unused
+)
+{
+ rtems_id tid;
+ rtems_time_of_day time;
+ uint32_t task_index;
+ rtems_status_code status;
+ int cpu_num;
+ char name[5];
+ char *p;
+
+ /* Get the task name */
+ p = rtems_object_get_name( RTEMS_SELF, 5, name );
+ rtems_test_assert( p != NULL );
+
+ status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+ task_index = task_number( tid );
+ for ( ; ; ) {
+
+ /* Get the CPU Number */
+ cpu_num = bsp_smp_processor_id();
+
+ status = rtems_clock_get_tod( &time );
+ if ( time.second >= 35 ) {
+ locked_printf( "*** END OF SMP08 TEST ***" );
+ rtems_test_exit( 0 );
+ }
+
+ PrintTaskInfo( p, &time );
+ status = rtems_task_wake_after(
+ task_index * 5 * rtems_clock_get_ticks_per_second() );
+ }
+}
diff --git a/testsuites/smptests/smp09/.cvsignore b/testsuites/smptests/smp09/.cvsignore
new file mode 100644
index 0000000000..282522db03
--- /dev/null
+++ b/testsuites/smptests/smp09/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/testsuites/smptests/smp09/Makefile.am b/testsuites/smptests/smp09/Makefile.am
new file mode 100644
index 0000000000..8c4178d951
--- /dev/null
+++ b/testsuites/smptests/smp09/Makefile.am
@@ -0,0 +1,27 @@
+##
+## $Id$
+##
+
+MANAGERS = all
+
+rtems_tests_PROGRAMS = smp09
+smp09_SOURCES = init.c ../../support/src/locked_print.c
+
+dist_rtems_tests_DATA = smp09.scn
+dist_rtems_tests_DATA += smp09.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+AM_CPPFLAGS += -DSMPTEST
+
+LINK_OBJS = $(smp09_OBJECTS) $(smp09_LDADD)
+LINK_LIBS = $(smp09_LDLIBS)
+
+smp09$(EXEEXT): $(smp09_OBJECTS) $(smp09_DEPENDENCIES)
+ @rm -f smp09$(EXEEXT)
+ $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/smptests/smp09/init.c b/testsuites/smptests/smp09/init.c
new file mode 100644
index 0000000000..59186c290f
--- /dev/null
+++ b/testsuites/smptests/smp09/init.c
@@ -0,0 +1,88 @@
+/*
+ * COPYRIGHT (c) 1989-2011.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+#include "test_support.h"
+#include <rtems/cpuuse.h>
+
+volatile int killtime;
+
+rtems_task Test_task(
+ rtems_task_argument argument
+)
+{
+ while (1)
+ ;
+ /* XXX something goes here */
+}
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ int i;
+ char ch;
+ int cpu_num;
+ rtems_id id;
+ rtems_status_code status;
+
+ locked_print_initialize();
+ locked_printf( "\n\n*** TEST SMP09 ***\n" );
+
+ for ( killtime=0; killtime<1000000; killtime++ )
+ ;
+
+ for ( i=0; i<rtems_smp_get_number_of_processors() -1; i++ ) {
+ ch = '1' + i;
+
+ status = rtems_task_create(
+ rtems_build_name( 'T', 'A', ch, ' ' ),
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &id
+ );
+ directive_failed( status, "task create" );
+
+ cpu_num = bsp_smp_processor_id();
+ locked_printf(" CPU %d start task TA%c\n", cpu_num, ch);
+
+ status = rtems_task_start( id, Test_task, i+1 );
+ directive_failed( status, "task start" );
+ }
+
+ locked_printf(" kill 10 clock ticks\n" );
+ while ( rtems_clock_get_ticks_since_boot() < 10 )
+ ;
+
+ rtems_cpu_usage_report();
+
+ locked_printf( "*** END OF TEST SMP09 ***" );
+ rtems_test_exit(0);
+}
+
+/* configuration information */
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_SMP_APPLICATION
+#define CONFIGURE_SMP_MAXIMUM_PROCESSORS 4
+
+#define CONFIGURE_MAXIMUM_TASKS \
+ (1 + CONFIGURE_SMP_MAXIMUM_PROCESSORS)
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_INIT
+
+#include <rtems/confdefs.h>
+/* end of file */
diff --git a/testsuites/smptests/smp09/smp09.doc b/testsuites/smptests/smp09/smp09.doc
new file mode 100644
index 0000000000..421b588286
--- /dev/null
+++ b/testsuites/smptests/smp09/smp09.doc
@@ -0,0 +1,22 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989-2011.
+# On-Line Applications Research Corporation (OAR).
+#
+# The license and distribution terms for this file may be
+# found in the file LICENSE in this distribution or at
+# http://www.rtems.com/license/LICENSE.
+#
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: smp09
+
+directives:
+
+ + rtems_cpu_usage_report
+
+concepts:
+
++ Verify that CPU usage reporting is correct in an SMP configuration
diff --git a/testsuites/smptests/smp09/smp09.scn b/testsuites/smptests/smp09/smp09.scn
new file mode 100644
index 0000000000..030c822c32
--- /dev/null
+++ b/testsuites/smptests/smp09/smp09.scn
@@ -0,0 +1,22 @@
+*** TEST SMP09 ***
+ CPU 0 start task TA1
+ CPU 0 start task TA2
+ CPU 0 start task TA3
+ kill 10 clock ticks
+-------------------------------------------------------------------------------
+ CPU USAGE BY THREAD
+------------+----------------------------------------+---------------+---------
+ ID | NAME | SECONDS | PERCENT
+------------+----------------------------------------+---------------+---------
+ 0x09010001 | IDLE | 0.000000 | 0.000
+ 0x09010002 | IDLE | 3.780012 | 15.060
+ 0x09010003 | IDLE | 26.961831 | 100.000
+ 0x09010004 | IDLE | 28.811601 | 100.000
+ 0x0A010001 | UI1 | 31.344809 | 100.000
+ 0x0A010002 | TA1 | 30.520797 | 88.979
+ 0x0A010003 | TA2 | 0.000000 | 0.000
+ 0x0A010004 | TA3 | 0.000000 | 0.000
+------------+----------------------------------------+---------------+---------
+ TIME SINCE LAST CPU USAGE RESET IN SECONDS: 39.731571
+-------------------------------------------------------------------------------
+*** END OF TEST SMP09 ***