diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2009-05-21 15:42:52 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2009-05-21 15:42:52 +0000 |
commit | 8abaa16177ea7de1e9862695285e09bc26e354f2 (patch) | |
tree | 1ebd1dbfe24afb3dc8551f7b4e668263c24e5509 /testsuites/sptests/sp50 | |
parent | 2009-05-21 Joel Sherrill <joel.sherrill@OARcorp.com> (diff) | |
download | rtems-8abaa16177ea7de1e9862695285e09bc26e354f2.tar.bz2 |
2009-05-21 Joel Sherrill <joel.sherrill@oarcorp.com>
PR 1413/cpukit
* Makefile.am, configure.ac: Add test for case where server based
timers which reinitiated themselves did not get reinserted onto timer
chain.
* sp50/.cvsignore, sp50/Makefile.am, sp50/init.c, sp50/sp50.doc,
sp50/sp50.scn: New files.
Diffstat (limited to 'testsuites/sptests/sp50')
-rw-r--r-- | testsuites/sptests/sp50/.cvsignore | 2 | ||||
-rw-r--r-- | testsuites/sptests/sp50/Makefile.am | 28 | ||||
-rw-r--r-- | testsuites/sptests/sp50/init.c | 92 | ||||
-rw-r--r-- | testsuites/sptests/sp50/sp50.doc | 23 | ||||
-rw-r--r-- | testsuites/sptests/sp50/sp50.scn | 12 |
5 files changed, 157 insertions, 0 deletions
diff --git a/testsuites/sptests/sp50/.cvsignore b/testsuites/sptests/sp50/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/testsuites/sptests/sp50/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/testsuites/sptests/sp50/Makefile.am b/testsuites/sptests/sp50/Makefile.am new file mode 100644 index 0000000000..dd244ba189 --- /dev/null +++ b/testsuites/sptests/sp50/Makefile.am @@ -0,0 +1,28 @@ +## +## $Id$ +## + +MANAGERS = all + +rtems_tests_PROGRAMS = sp50 +sp50_SOURCES = init.c + +dist_rtems_tests_DATA = sp50.scn +dist_rtems_tests_DATA += sp50.doc + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am +include $(top_srcdir)/../automake/leaf.am + +sp50_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel) + +AM_CPPFLAGS += -I$(top_srcdir)/../support/include + +LINK_OBJS = $(sp50_OBJECTS) $(sp50_LDADD) +LINK_LIBS = $(sp50_LDLIBS) + +sp50$(EXEEXT): $(sp50_OBJECTS) $(sp50_DEPENDENCIES) + @rm -f sp50$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/sptests/sp50/init.c b/testsuites/sptests/sp50/init.c new file mode 100644 index 0000000000..36f8476d6e --- /dev/null +++ b/testsuites/sptests/sp50/init.c @@ -0,0 +1,92 @@ +/* + * 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> + +volatile int Fired; +volatile bool timerRan; + +rtems_timer_service_routine Timer_Routine( rtems_id id, void *ignored ) +{ + rtems_status_code sc; + + Fired++; + timerRan = true; + + sc = rtems_timer_server_fire_after( + id, + get_ticks_per_second(), + Timer_Routine, + NULL + ); +} + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code sc; + rtems_id timer1; + struct timespec uptime; + + puts( "\n\n*** TEST 50 ***" ); + + sc = rtems_timer_initiate_server( + 1, + RTEMS_MINIMUM_STACK_SIZE, + RTEMS_DEFAULT_ATTRIBUTES + ); + directive_failed( sc, "rtems_timer_initiate_server" ); + + sc = rtems_timer_create(rtems_build_name( 'T', 'M', 'R', '1' ), &timer1); + directive_failed( sc, "rtems_timer_create" ); + + Fired = 0; + timerRan = false; + + Timer_Routine(timer1, NULL); + + while (1) { + sc = rtems_task_wake_after( 10 ); + directive_failed( sc, "rtems_task_wake_after" ); + + if ( timerRan == true ) { + timerRan = false; + + sc = rtems_clock_get_uptime( &uptime ); + directive_failed( sc, "rtems_clock_get_uptime" ); + + printf( "Timer fired at %d\n", uptime.tv_sec ); + } + + if ( Fired >= 10 ) { + puts( "*** END OF TEST 50 ***" ); + rtems_test_exit( 0 ); + } + /* technically the following is a critical section */ + } +} + + +/**************** START OF CONFIGURATION INFORMATION ****************/ + +#define CONFIGURE_INIT +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 2 +#define CONFIGURE_MAXIMUM_TIMERS 1 + +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE + +#include <rtems/confdefs.h> + +/**************** END OF CONFIGURATION INFORMATION ****************/ diff --git a/testsuites/sptests/sp50/sp50.doc b/testsuites/sptests/sp50/sp50.doc new file mode 100644 index 0000000000..2e755dbfc0 --- /dev/null +++ b/testsuites/sptests/sp50/sp50.doc @@ -0,0 +1,23 @@ +# +# $Id$ +# +# 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. +# + +This file describes the directives and concepts tested by this test set. + +test set name: sp50 + +directives: + + rtems_timer_initiate_server + rtems_timer_server_fire_after + +concepts: + ++ Ensure that a server based timer can repeatedly schedule itself to fire. diff --git a/testsuites/sptests/sp50/sp50.scn b/testsuites/sptests/sp50/sp50.scn new file mode 100644 index 0000000000..db6e339755 --- /dev/null +++ b/testsuites/sptests/sp50/sp50.scn @@ -0,0 +1,12 @@ +*** TEST 50 *** +Timer fired at 0 +Timer fired at 1 +Timer fired at 2 +Timer fired at 3 +Timer fired at 4 +Timer fired at 5 +Timer fired at 6 +Timer fired at 7 +Timer fired at 8 +Timer fired at 9 +*** END OF TEST 50 *** |