summaryrefslogtreecommitdiff
path: root/testsuites/smptests/smp08
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/smp08
parentb6afcb6083d227eff383d06c7d17c37ecbd4c227 (diff)
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/smp08')
-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
7 files changed, 271 insertions, 0 deletions
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() );
+ }
+}