summaryrefslogtreecommitdiffstats
path: root/testsuites/sptests/sp31/task1.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2002-03-29 15:32:08 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2002-03-29 15:32:08 +0000
commit5729f62e12673f322451fd4dcd6e790ec1e2ccef (patch)
tree234256187190ca3ea6193b47aa62d41b7fe27472 /testsuites/sptests/sp31/task1.c
parent82e1e997cac695532f8382cee94d770cc7fb59ec (diff)
downloadrtems-5729f62e12673f322451fd4dcd6e790ec1e2ccef.tar.bz2
2001-03-29 Joel Sherrill <joel@OARcorp.com>
* Per PR147 addressed problems when reseting and inserting a timer into a timer chain that did not honor time passage since the last time the timer server was scheduled and the new insertion. * sp31/sp31.scn, sp31/task1.c: Added test code to detect this case.
Diffstat (limited to 'testsuites/sptests/sp31/task1.c')
-rw-r--r--testsuites/sptests/sp31/task1.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/testsuites/sptests/sp31/task1.c b/testsuites/sptests/sp31/task1.c
index 2e21b15dce..661fab1b4f 100644
--- a/testsuites/sptests/sp31/task1.c
+++ b/testsuites/sptests/sp31/task1.c
@@ -20,6 +20,16 @@
#include "system.h"
+volatile int TSR_fired;
+
+rtems_timer_service_routine Should_not_fire_TSR(
+ rtems_id ignored_id,
+ void *ignored_address
+)
+{
+ TSR_fired = 1;
+}
+
rtems_task Task_1(
rtems_task_argument argument
)
@@ -42,6 +52,39 @@ rtems_task Task_1(
directive_failed( status, "rtems_timer_ident" );
printf( "TA1 - timer 2 has id (0x%x)\n", tmid2 );
+/* make sure insertion does not unintentionally fire a timer per PR147 */
+
+ TSR_fired = 0;
+
+ puts( "TA1 - rtems_timer_server_fire_after - 1 second" );
+ status = rtems_timer_server_fire_after(
+ tmid, TICKS_PER_SECOND, Should_not_fire_TSR, NULL );
+ directive_failed( status, "rtems_timer_server_fire_after" );
+
+ puts( "TA1 - rtems_task_wake_after - 1/2 second" );
+ status = rtems_task_wake_after( TICKS_PER_SECOND / 2 );
+ directive_failed( status, "rtems_timer_server_fire_after" );
+
+ directive_failed( status, "rtems_timer_server_fire_after" );
+ puts( "TA1 - rtems_timer_server_fire_after - timer 2 in 1/2 second" );
+ status = rtems_timer_server_fire_after(
+ tmid2, TICKS_PER_SECOND / 2, Should_not_fire_TSR, NULL );
+ directive_failed( status, "rtems_timer_server_fire_after" );
+
+ if ( TSR_fired ) {
+ puts( "TA1 - TSR fired and should not have!" );
+ exit(1);
+ }
+
+ puts( "TA1 - rtems_timer_cancel - timer 1" );
+ status = rtems_timer_cancel( tmid );
+ directive_failed( status, "rtems_timer_cancel" );
+
+ puts( "TA1 - rtems_timer_cancel - timer 2" );
+ status = rtems_timer_cancel( tmid2 );
+ directive_failed( status, "rtems_timer_cancel" );
+
+
/* now check that rescheduling an active timer works OK. */
puts( "TA1 - rtems_timer_server_fire_after - timer 1 in 30 seconds" );
status = rtems_timer_server_fire_after(