diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-10-13 09:53:09 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-10-13 09:56:26 +0200 |
commit | 7b8c0e89246e9c8e46d185eb16c838e56ae95c73 (patch) | |
tree | 20f28fb7fd8cce01ba1b853df1316508a3c63c6b | |
parent | ada9035dbe1acc94edf5b938b6b3a2dcd3f8ed83 (diff) |
testsuites/validation/tc-timer-server-fire-after.c
-rw-r--r-- | testsuites/validation/tc-timer-server-fire-after.c | 57 |
1 files changed, 53 insertions, 4 deletions
diff --git a/testsuites/validation/tc-timer-server-fire-after.c b/testsuites/validation/tc-timer-server-fire-after.c index 1d1fa2de66..3ca8f3335f 100644 --- a/testsuites/validation/tc-timer-server-fire-after.c +++ b/testsuites/validation/tc-timer-server-fire-after.c @@ -186,10 +186,11 @@ typedef enum { } PreConditionContext; typedef enum { - SCHEDULE_NONE = 0, - SCHEDULE_SOON = 1, - SCHEDULE_LATER = 2, - SCHEDULE_MAX = 5 + SCHEDULE_NONE = 0, + SCHEDULE_VERY_SOON = 1, + SCHEDULE_SOON = 2, + SCHEDULE_LATER = 3, + SCHEDULE_MAX = 5 } Scheduling_Ticks; /** @@ -202,6 +203,14 @@ typedef struct { rtems_id timer_id; /** + * @brief This member contains a valid id of a second timer. + * + * This timer is used reach branch coverage in an if-statement which only + * serves performance optimization. + */ + rtems_id timer_cover_id; + + /** * @brief This member specifies the ``id`` parameter for the action. */ rtems_id id_param; @@ -400,6 +409,19 @@ RTEMS_INLINE_ROUTINE void TimerServiceRoutine( ctx->routine_user_data = user_data; } +/* + * This service routine is used reach branch coverage in an if-statement + * which only serves performance optimization. + */ +RTEMS_INLINE_ROUTINE void TimerServiceRoutineCover( + rtems_id timer_cover_id, + void *user_data +) +{ + (void) timer_cover_id; + (void) user_data; +} + static void RtemsTimerReqServerFireAfter_Pre_Server_Prepare( RtemsTimerReqServerFireAfter_Context *ctx, RtemsTimerReqServerFireAfter_Pre_Server state @@ -657,6 +679,26 @@ static void RtemsTimerReqServerFireAfter_Pre_State_Prepare( /* * While the timer is in pending state. */ + rtems_status_code status; + if ( ctx->pre_cond_contex == PRE_SERVER ) { + /* + * This call to rtems_timer_fire_after() serves to reach branch coverage + * in an if-statement which only serves performance optimization. + * + * cpukit/rtems/src/timerserver.c:70 else-branch was not reached: + * if ( wakeup ) { + * (void) rtems_event_system_send( ts->server_id, RTEMS_EVENT_SYSTEM_SERVER ); + * } + */ + status = rtems_timer_server_fire_after( + ctx->timer_cover_id, + SCHEDULE_VERY_SOON, + TimerServiceRoutineCover, + ctx + ); + T_rsc_success( status ); + } + T_rsc_success( rtems_task_suspend( GetTimerServerTaskId() ) ); TriggerTimer( ctx ); T_eq_int( ctx->invocations, 0 ); @@ -990,6 +1032,12 @@ static void RtemsTimerReqServerFireAfter_Prepare( ); T_rsc_success( status ); + status = rtems_timer_create( + rtems_build_name( 'C', 'O', 'V', 'R' ), + &ctx->timer_cover_id + ); + T_rsc_success( status ); + ctx->invocations = 0; ctx->ticks_till_fire = SCHEDULE_NONE; ctx->routine_user_data = NULL; @@ -1018,6 +1066,7 @@ static void RtemsTimerReqServerFireAfter_Cleanup( RtemsTimerReqServerFireAfter_Context *ctx ) { + T_rsc_success( rtems_timer_delete( ctx->timer_cover_id ) ); T_rsc_success( rtems_timer_delete( ctx->timer_id ) ); DeleteTimerServer(); } |