From 8abaa16177ea7de1e9862695285e09bc26e354f2 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Thu, 21 May 2009 15:42:52 +0000 Subject: 2009-05-21 Joel Sherrill 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. --- testsuites/sptests/ChangeLog | 9 ++++ testsuites/sptests/Makefile.am | 5 +- testsuites/sptests/configure.ac | 1 + testsuites/sptests/sp50/.cvsignore | 2 + testsuites/sptests/sp50/Makefile.am | 28 +++++++++++ testsuites/sptests/sp50/init.c | 92 +++++++++++++++++++++++++++++++++++++ testsuites/sptests/sp50/sp50.doc | 23 ++++++++++ testsuites/sptests/sp50/sp50.scn | 12 +++++ 8 files changed, 170 insertions(+), 2 deletions(-) create mode 100644 testsuites/sptests/sp50/.cvsignore create mode 100644 testsuites/sptests/sp50/Makefile.am create mode 100644 testsuites/sptests/sp50/init.c create mode 100644 testsuites/sptests/sp50/sp50.doc create mode 100644 testsuites/sptests/sp50/sp50.scn (limited to 'testsuites') diff --git a/testsuites/sptests/ChangeLog b/testsuites/sptests/ChangeLog index 2e9156e081..e7241e8a46 100644 --- a/testsuites/sptests/ChangeLog +++ b/testsuites/sptests/ChangeLog @@ -1,3 +1,12 @@ +2009-05-21 Joel Sherrill + + 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. + 2009-05-21 Joel Sherrill PR 1414/cpukit diff --git a/testsuites/sptests/Makefile.am b/testsuites/sptests/Makefile.am index 696e2ec9f4..dd5e5d0615 100644 --- a/testsuites/sptests/Makefile.am +++ b/testsuites/sptests/Makefile.am @@ -8,8 +8,9 @@ ACLOCAL_AMFLAGS = -I ../aclocal SUBDIRS = sp01 sp02 sp03 sp04 sp05 sp06 sp07 sp08 sp09 sp11 sp12 sp13 sp14 \ sp15 sp16 sp17 sp19 sp20 sp21 sp22 sp23 sp24 sp25 sp26 sp27 sp28 sp29 \ sp30 sp31 sp32 sp33 sp34 sp35 sp37 sp38 sp39 sp40 sp41 sp42 sp43 sp44 \ - sp45 sp46 sp47 sp48 sp49 spsize spwatchdog spfatal01 spfatal02 spfatal03 \ - spfatal04 spfatal05 spfatal06 spfatal07 spfatal08 spfatal09 spobjgetnext \ + sp45 sp46 sp47 sp48 sp49 sp50 spsize spwatchdog \ + spfatal01 spfatal02 spfatal03 spfatal04 spfatal05 spfatal06 spfatal07 \ + spfatal08 spfatal09 spobjgetnext \ spprintk spwkspace DIST_SUBDIRS = $(SUBDIRS) spfatal spfatal_support diff --git a/testsuites/sptests/configure.ac b/testsuites/sptests/configure.ac index 35c3ad786a..939045fe75 100644 --- a/testsuites/sptests/configure.ac +++ b/testsuites/sptests/configure.ac @@ -74,6 +74,7 @@ sp46/Makefile sp47/Makefile sp48/Makefile sp49/Makefile +sp50/Makefile spwatchdog/Makefile spsize/Makefile spfatal/Makefile 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 + +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 + +/**************** 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 *** -- cgit v1.2.3