summaryrefslogtreecommitdiffstats
path: root/testsuites
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2009-10-10 15:03:30 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2009-10-10 15:03:30 +0000
commitc257fb9ed5310b06d85dee2cf0ffb98b42acd3a1 (patch)
treebf7e2b5f385572b184261e1433f5605298c0cf7a /testsuites
parent2009-10-09 Till Straumann <strauman@slac.stanford.edu> (diff)
downloadrtems-c257fb9ed5310b06d85dee2cf0ffb98b42acd3a1.tar.bz2
2009-10-10 Joel Sherrill <joel.sherrill@oarcorp.com>
* Makefile.am, configure.ac: Add new test to exercise when the ticks since boot wraps around 0 and the timer server must deal with that condition. * sp67/.cvsignore, sp67/Makefile.am, sp67/init.c, sp67/sp67.doc, sp67/sp67.scn: New files.
Diffstat (limited to 'testsuites')
-rw-r--r--testsuites/sptests/ChangeLog8
-rw-r--r--testsuites/sptests/Makefile.am2
-rw-r--r--testsuites/sptests/configure.ac1
-rw-r--r--testsuites/sptests/sp67/.cvsignore2
-rw-r--r--testsuites/sptests/sp67/Makefile.am28
-rw-r--r--testsuites/sptests/sp67/init.c124
-rw-r--r--testsuites/sptests/sp67/sp67.doc23
-rw-r--r--testsuites/sptests/sp67/sp67.scn8
8 files changed, 195 insertions, 1 deletions
diff --git a/testsuites/sptests/ChangeLog b/testsuites/sptests/ChangeLog
index 32561f5143..0271b3a30f 100644
--- a/testsuites/sptests/ChangeLog
+++ b/testsuites/sptests/ChangeLog
@@ -1,3 +1,11 @@
+2009-10-10 Joel Sherrill <joel.sherrill@oarcorp.com>
+
+ * Makefile.am, configure.ac: Add new test to exercise when the ticks
+ since boot wraps around 0 and the timer server must deal with that
+ condition.
+ * sp67/.cvsignore, sp67/Makefile.am, sp67/init.c, sp67/sp67.doc,
+ sp67/sp67.scn: New files.
+
2009-10-09 Sebastian Huber <Sebastian.Huber@embedded-brains.de>
* sp40/init.c, sp40/sp40.doc, sp40/sp40.scn: New test cases.
diff --git a/testsuites/sptests/Makefile.am b/testsuites/sptests/Makefile.am
index a2880eac95..ce995c5569 100644
--- a/testsuites/sptests/Makefile.am
+++ b/testsuites/sptests/Makefile.am
@@ -13,7 +13,7 @@ SUBDIRS = \
sp30 sp31 sp32 sp33 sp34 sp35 sp37 sp38 sp39 \
sp40 sp41 sp42 sp43 sp44 sp45 sp46 sp47 sp48 sp49 \
sp50 sp51 sp52 sp53 sp54 sp55 sp56 sp57 sp58 sp59 \
- sp60 sp61 sp62 sp63 sp64 sp65 sp66 \
+ sp60 sp61 sp62 sp63 sp64 sp65 sp66 sp67 \
spchain spclockget spcoverage spobjgetnext spnotepad01 spprintk spsize \
spstkalloc spthreadq01 spwatchdog spwkspace \
spfatal01 spfatal02 spfatal03 spfatal04 spfatal05 spfatal06 spfatal07 \
diff --git a/testsuites/sptests/configure.ac b/testsuites/sptests/configure.ac
index a96350c2a3..e0ddb1254f 100644
--- a/testsuites/sptests/configure.ac
+++ b/testsuites/sptests/configure.ac
@@ -92,6 +92,7 @@ sp63/Makefile
sp64/Makefile
sp65/Makefile
sp66/Makefile
+sp67/Makefile
spchain/Makefile
spclockget/Makefile
spcoverage/Makefile
diff --git a/testsuites/sptests/sp67/.cvsignore b/testsuites/sptests/sp67/.cvsignore
new file mode 100644
index 0000000000..282522db03
--- /dev/null
+++ b/testsuites/sptests/sp67/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/testsuites/sptests/sp67/Makefile.am b/testsuites/sptests/sp67/Makefile.am
new file mode 100644
index 0000000000..467f8123f2
--- /dev/null
+++ b/testsuites/sptests/sp67/Makefile.am
@@ -0,0 +1,28 @@
+##
+## $Id$
+##
+
+MANAGERS = all
+
+rtems_tests_PROGRAMS = sp67
+sp67_SOURCES = init.c
+
+dist_rtems_tests_DATA = sp67.scn
+dist_rtems_tests_DATA += sp67.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+sp67_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel)
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
+LINK_OBJS = $(sp67_OBJECTS) $(sp67_LDADD)
+LINK_LIBS = $(sp67_LDLIBS)
+
+sp67$(EXEEXT): $(sp67_OBJECTS) $(sp67_DEPENDENCIES)
+ @rm -f sp67$(EXEEXT)
+ $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/sptests/sp67/init.c b/testsuites/sptests/sp67/init.c
new file mode 100644
index 0000000000..874c9a2c63
--- /dev/null
+++ b/testsuites/sptests/sp67/init.c
@@ -0,0 +1,124 @@
+/*
+ * Based upon test code posted on the RTEMS User's Mailing List
+ * by Sergio Faustino <sergio.faustino@edisoft.pt>:
+ *
+ * http://www.rtems.org/pipermail/rtems-users/2009-June/005540.html
+ *
+ * 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>
+
+/*
+ * We have to extern this rather than use __RTEMS_VIOLATE_KERNEL_VISIBILITY__
+ * because this variable isn't actually in any .h.
+ */
+extern Watchdog_Interval _Timer_Server_ticks_last_time;
+
+volatile bool _timer_passage_1 = FALSE;
+volatile bool _timer_passage_2 = FALSE;
+
+/*timer Routine*/
+rtems_timer_service_routine TIMER_service_routine(
+ rtems_id ignored_id,
+ void *user_data
+)
+{
+ bool *passed = (bool *)user_data;
+ *passed = TRUE;
+}
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_id timer1;
+ rtems_id timer2;
+ rtems_name timer_name;
+
+ puts( "\n\n*** TEST 67 ***" );
+
+ /* build timer name*/
+
+ /* create Timer */
+ puts( "Init - create timer 1" );
+ status = rtems_timer_create( rtems_build_name('T', 'M', '1', ' '), &timer1 );
+ directive_failed( status, "rtems_timer_create #1" );
+
+ puts( "Init - create timer 2" );
+ status = rtems_timer_create( rtems_build_name('T', 'M', '2', ' '), &timer2 );
+ directive_failed( status, "rtems_timer_create #1" );
+
+ /* initiate timer server */
+ puts( "Init - Initiate the timer server" );
+ status = rtems_timer_initiate_server(
+ RTEMS_MINIMUM_PRIORITY,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_ATTRIBUTES
+ );
+ directive_failed( status, "rtems_timer_initiate_server" );
+
+ status = rtems_task_wake_after( 10 );
+ directive_failed( status, "task wake_after" );
+
+ status = rtems_timer_server_fire_after(
+ timer1,
+ 0xffff,
+ TIMER_service_routine,
+ (void*) &_timer_passage_1
+ );
+ directive_failed( status, "rtems_timer_server_fire_after" );
+
+ /* Make the timer server think that the ticks has wrapped */
+ _Timer_Server_ticks_last_time = 100;
+
+ status = rtems_task_wake_after( 10 );
+ directive_failed( status, "task wake_after" );
+
+ /* Make the timer server think that the ticks has wrapped */
+ _Timer_Server_ticks_last_time = 200;
+
+ status = rtems_timer_server_fire_after(
+ timer2,
+ 0xffff,
+ TIMER_service_routine,
+ (void*) &_timer_passage_2
+ );
+ directive_failed( status, "rtems_timer_server_fire_after" );
+
+ status = rtems_task_wake_after( 10 );
+ directive_failed( status, "task wake_after" );
+
+ if (!_timer_passage_1) {
+ puts( "Timer 1 FAILED to fire after wrapping time");
+ rtems_test_exit(0);
+ }
+ puts( "Server Timer 1 fired after wrapping ticks since boot-- OK");
+
+ if (_timer_passage_2) {
+ puts( "Timer 2 fired and should not have after wrapping time");
+ rtems_test_exit(0);
+ }
+
+ puts( "*** END OF TEST 67 ***" );
+ rtems_test_exit(0);
+}
+
+/* configuration stuff */
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 2
+#define CONFIGURE_MAXIMUM_TIMERS 2
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_INIT
+#include <rtems/confdefs.h>
diff --git a/testsuites/sptests/sp67/sp67.doc b/testsuites/sptests/sp67/sp67.doc
new file mode 100644
index 0000000000..1ddf3b5bcf
--- /dev/null
+++ b/testsuites/sptests/sp67/sp67.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: sp67
+
+directives:
+
+ rtems_timer_server_fire_after
+
+concepts:
+
++ Ensure that if the ticks since boot counter wraps, the Timer Server
+ operates properly.
diff --git a/testsuites/sptests/sp67/sp67.scn b/testsuites/sptests/sp67/sp67.scn
new file mode 100644
index 0000000000..77296fc538
--- /dev/null
+++ b/testsuites/sptests/sp67/sp67.scn
@@ -0,0 +1,8 @@
+*** TEST 67 ***
+Init - create timer 1
+Init - create timer 2
+Init - Initiate the timer server
+hit snapshot=10 ticks=-91
+hit snapshot=20 ticks=-181
+Server Timer 1 fired after wrapping ticks since boot-- OK
+*** END OF TEST 67 ***