diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2011-06-28 21:08:48 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2011-06-28 21:08:48 +0000 |
commit | e049eeae908fe5d6418433aa1495c796cc58424f (patch) | |
tree | 9ae2ca088f2dfc3787d5965e904b1c738e14ad57 /testsuites/smptests/smp03 | |
parent | 2011-05-24 Joel Sherrill <joel.sherrill@oarcorp.com> (diff) | |
download | rtems-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/smp03')
-rw-r--r-- | testsuites/smptests/smp03/.cvsignore | 2 | ||||
-rw-r--r-- | testsuites/smptests/smp03/Makefile.am | 29 | ||||
-rw-r--r-- | testsuites/smptests/smp03/init.c | 94 | ||||
-rw-r--r-- | testsuites/smptests/smp03/smp03.doc | 19 | ||||
-rw-r--r-- | testsuites/smptests/smp03/smp03.scn | 7 | ||||
-rw-r--r-- | testsuites/smptests/smp03/system.h | 68 | ||||
-rw-r--r-- | testsuites/smptests/smp03/tasks.c | 38 |
7 files changed, 257 insertions, 0 deletions
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) + ; +} |