summaryrefslogtreecommitdiffstats
path: root/testsuites
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
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')
-rw-r--r--testsuites/sptests/ChangeLog7
-rw-r--r--testsuites/sptests/sp31/sp31.scn33
-rw-r--r--testsuites/sptests/sp31/task1.c43
3 files changed, 78 insertions, 5 deletions
diff --git a/testsuites/sptests/ChangeLog b/testsuites/sptests/ChangeLog
index d3e8d31430..973936a0e9 100644
--- a/testsuites/sptests/ChangeLog
+++ b/testsuites/sptests/ChangeLog
@@ -1,3 +1,10 @@
+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.
+
2001-03-28 Joel Sherrill <joel@OARcorp.com>
* Side-effect of PR132.
diff --git a/testsuites/sptests/sp31/sp31.scn b/testsuites/sptests/sp31/sp31.scn
index f39ac58054..9f94652602 100644
--- a/testsuites/sptests/sp31/sp31.scn
+++ b/testsuites/sptests/sp31/sp31.scn
@@ -1,18 +1,41 @@
*** TEST 31 ***
INIT - rtems_timer_create - creating timer 1
INIT - timer 1 has id (0x14010001)
+INIT - rtems_timer_create - creating timer 2
+INIT - timer 2 has id (0x14010002)
TA1 - rtems_timer_ident - identing timer 1
TA1 - timer 1 has id (0x14010001)
-TA1 - rtems_clock_get - 09:00:00 12/31/1988
+TA1 - rtems_timer_ident - identing timer 2
+TA1 - timer 2 has id (0x14010002)
+TA1 - rtems_timer_server_fire_after - 1 second
+TA1 - rtems_task_wake_after - 1/2 second
+TA1 - rtems_timer_server_fire_after - timer 2 in 1/2 second
+TA1 - rtems_timer_cancel - timer 1
+TA1 - rtems_timer_cancel - timer 2
+TA1 - rtems_timer_server_fire_after - timer 1 in 30 seconds
+TA1 - rtems_timer_server_fire_after - timer 2 in 60 seconds
+Timer 1 scheduled for 3050 ticks since boot
+Timer Server scheduled for 3050 ticks since boot
+TA1 - rtems_task_wake_after - 1 second
+TA1 - rtems_timer_server_fire_after - timer 2 in 60 seconds
+Timer 1 scheduled for 3050 ticks since boot
+Timer Server scheduled for 3050 ticks since boot
+TA1 - rtems_task_wake_after - 1 second
+TA1 - rtems_timer_server_fire_after - timer 2 in 60 seconds
+Timer 1 scheduled for 3050 ticks since boot
+Timer Server scheduled for 3050 ticks since boot
+TA1 - rtems_timer_cancel - timer 1
+TA1 - rtems_timer_cancel - timer 2
+TA1 - rtems_clock_get - 09:00:02 12/31/1988
TA1 - rtems_timer_server_fire_after - timer 1 in 3 seconds
TA1 - rtems_task_suspend( RTEMS_SELF )
-TA1 - rtems_clock_get - 09:00:03 12/31/1988
+TA1 - rtems_clock_get - 09:00:05 12/31/1988
TA1 - rtems_timer_server_fire_after - timer 1 in 3 seconds
TA1 - rtems_task_wake_after - 1 second
-TA1 - rtems_clock_get - 09:00:04 12/31/1988
+TA1 - rtems_clock_get - 09:00:06 12/31/1988
TA1 - rtems_timer_reset - timer 1
TA1 - rtems_task_suspend( RTEMS_SELF )
-TA1 - rtems_clock_get - 09:00:07 12/31/1988
+TA1 - rtems_clock_get - 09:00:09 12/31/1988
<pause>
TA1 - rtems_timer_server_fire_after - timer 1 in 3 seconds
TA1 - rtems_timer_cancel - timer 1
@@ -26,4 +49,4 @@ TA1 - rtems_clock_get - 09:00:11 12/31/1988
TA1 - rtems_timer_cancel - timer 1
TA1 - rtems_task_wake_after - YIELD (only task at priority)
TA1 - timer_deleting - timer 1
-*** END OF TEST 31 ***
+*** END OF TEST 31 ***
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(