From 89ed8a9055f7415bbbe989b1ee71ea86c3d511d6 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Fri, 11 Mar 2011 16:39:27 +0000 Subject: 2011-03-11 Joel Sherrill * Makefile.am, configure.ac: Add sp73. This is a new test designed to improve coverage of the thread yield logic. * sp73/.cvsignore, sp73/Makefile.am, sp73/init.c, sp73/sp73.doc, sp73/sp73.scn: New files. --- testsuites/sptests/ChangeLog | 7 +++ testsuites/sptests/Makefile.am | 2 +- testsuites/sptests/configure.ac | 1 + testsuites/sptests/sp73/.cvsignore | 2 + testsuites/sptests/sp73/Makefile.am | 26 +++++++++ testsuites/sptests/sp73/init.c | 107 ++++++++++++++++++++++++++++++++++++ testsuites/sptests/sp73/sp73.doc | 22 ++++++++ testsuites/sptests/sp73/sp73.scn | 8 +++ 8 files changed, 174 insertions(+), 1 deletion(-) create mode 100644 testsuites/sptests/sp73/.cvsignore create mode 100644 testsuites/sptests/sp73/Makefile.am create mode 100644 testsuites/sptests/sp73/init.c create mode 100644 testsuites/sptests/sp73/sp73.doc create mode 100644 testsuites/sptests/sp73/sp73.scn (limited to 'testsuites/sptests') diff --git a/testsuites/sptests/ChangeLog b/testsuites/sptests/ChangeLog index 9ea9f7dccd..11262059e7 100644 --- a/testsuites/sptests/ChangeLog +++ b/testsuites/sptests/ChangeLog @@ -1,3 +1,10 @@ +2011-03-11 Joel Sherrill + + * Makefile.am, configure.ac: Add sp73. This is a new test designed + to improve coverage of the thread yield logic. + * sp73/.cvsignore, sp73/Makefile.am, sp73/init.c, sp73/sp73.doc, + sp73/sp73.scn: New files. + 2011-03-10 Sebastian Huber * sp07/init.c: Improve coverage. diff --git a/testsuites/sptests/Makefile.am b/testsuites/sptests/Makefile.am index 90a6fd886d..202026b4e9 100644 --- a/testsuites/sptests/Makefile.am +++ b/testsuites/sptests/Makefile.am @@ -14,7 +14,7 @@ SUBDIRS = \ sp40 sp41 sp42 sp43 sp44 sp45 sp46 sp47 sp48 sp49 \ sp50 sp51 sp52 sp53 sp54 sp55 sp56 sp57 sp58 sp59 \ sp60 sp62 sp63 sp64 sp65 sp66 sp67 sp68 sp69 \ - sp70 sp71 sp72 \ + sp70 sp71 sp72 sp73 \ spassoc01 spchain spclockget spcoverage spobjgetnext \ spnotepad01 spprintk spprivenv01 spsize spstkalloc spthreadq01 \ spwatchdog spwkspace \ diff --git a/testsuites/sptests/configure.ac b/testsuites/sptests/configure.ac index 312dd0a67e..4232720841 100644 --- a/testsuites/sptests/configure.ac +++ b/testsuites/sptests/configure.ac @@ -98,6 +98,7 @@ sp69/Makefile sp70/Makefile sp71/Makefile sp72/Makefile +sp73/Makefile spassoc01/Makefile spchain/Makefile spclockget/Makefile diff --git a/testsuites/sptests/sp73/.cvsignore b/testsuites/sptests/sp73/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/testsuites/sptests/sp73/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/testsuites/sptests/sp73/Makefile.am b/testsuites/sptests/sp73/Makefile.am new file mode 100644 index 0000000000..271ca2f723 --- /dev/null +++ b/testsuites/sptests/sp73/Makefile.am @@ -0,0 +1,26 @@ +## +## $Id$ +## + +MANAGERS = all + +rtems_tests_PROGRAMS = sp73 +sp73_SOURCES = init.c + +dist_rtems_tests_DATA = sp73.scn +dist_rtems_tests_DATA += sp73.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 + +LINK_OBJS = $(sp73_OBJECTS) $(sp73_LDADD) +LINK_LIBS = $(sp73_LDLIBS) + +sp73$(EXEEXT): $(sp73_OBJECTS) $(sp73_DEPENDENCIES) + @rm -f sp73$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/sptests/sp73/init.c b/testsuites/sptests/sp73/init.c new file mode 100644 index 0000000000..a4622396e3 --- /dev/null +++ b/testsuites/sptests/sp73/init.c @@ -0,0 +1,107 @@ +/* + * COPYRIGHT (c) 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 +#include +#include "tmacros.h" + +rtems_id Task_id[ 4 ]; /* array of task ids */ +rtems_name Task_name[ 4 ]; /* array of task names */ + +rtems_task Test_task( + rtems_task_argument arg +) +{ + rtems_time_of_day time; + uint32_t task_index; + rtems_status_code status; + + task_index = arg; + for ( ; ; ) { + status = rtems_clock_get_tod( &time ); + if ( time.second >= 15 ) { + puts( "*** END OF SP73 (YIELD) TEST ***" ); + rtems_test_exit( 0 ); + } + put_name( Task_name[ task_index ], FALSE ); + print_time( " - rtems_clock_get_tod - ", &time, "\n" ); + status = rtems_task_wake_after( + task_index * 5 * rtems_clock_get_ticks_per_second() ); + } +} + + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + rtems_time_of_day time; + rtems_task_priority old; + + puts( "\n\n*** SP73 (YIELD) TEST ***" ); + + 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 ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); + + status = rtems_task_create( + Task_name[ 1 ], 1, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 1 ] + ); + status = rtems_task_create( + Task_name[ 2 ], 1, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 2 ] + ); + status = rtems_task_create( + Task_name[ 3 ], 1, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 3 ] + ); + + status = rtems_task_start( Task_id[ 1 ], Test_task, 1 ); + rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); + status = rtems_task_start( Task_id[ 2 ], Test_task, 2 ); + rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); + status = rtems_task_start( Task_id[ 3 ], Test_task, 3 ); + + rtems_task_set_priority(Task_id[1], 1, &old); + rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); + + status = rtems_task_delete( RTEMS_SELF ); +} + +/* configuration information */ +#define CONFIGURE_SCHEDULER_SIMPLE +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 4 + +#define CONFIGURE_INIT_TASK_PRIORITY 2 +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE + +#define CONFIGURE_INIT +#include +/* end of file */ diff --git a/testsuites/sptests/sp73/sp73.doc b/testsuites/sptests/sp73/sp73.doc new file mode 100644 index 0000000000..bc389f99de --- /dev/null +++ b/testsuites/sptests/sp73/sp73.doc @@ -0,0 +1,22 @@ +# +# $Id$ +# +# COPYRIGHT (c) 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: sp73 + +directives: + + rtems_task_wake_after - yield case + +concepts: + ++ The purpose of this test is to exercise paths in the yield scheduling + logic. diff --git a/testsuites/sptests/sp73/sp73.scn b/testsuites/sptests/sp73/sp73.scn new file mode 100644 index 0000000000..53b6e82135 --- /dev/null +++ b/testsuites/sptests/sp73/sp73.scn @@ -0,0 +1,8 @@ +*** SP73 (YIELD) TEST *** +TA1 - rtems_clock_get_tod - 09:00:00 12/31/1988 +TA2 - rtems_clock_get_tod - 09:00:00 12/31/1988 +TA3 - rtems_clock_get_tod - 09:00:00 12/31/1988 +TA1 - rtems_clock_get_tod - 09:00:05 12/31/1988 +TA1 - rtems_clock_get_tod - 09:00:10 12/31/1988 +TA2 - rtems_clock_get_tod - 09:00:10 12/31/1988 +*** END OF SP73 (YIELD) TEST *** -- cgit v1.2.3