From 1e8d5384b77bb89ae267f4c7c3205036daf4ffdf Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 8 Oct 2021 16:11:59 +0200 Subject: validation: Rate monotonic manager --- testsuites/validation/tc-ratemon-cancel.c | 45 +++++---------------------- testsuites/validation/tc-ratemon-get-status.c | 17 +++++++--- testsuites/validation/tc-ratemon-period.c | 6 ++-- testsuites/validation/tc-ratemon-timeout.c | 28 +++++++++-------- 4 files changed, 36 insertions(+), 60 deletions(-) diff --git a/testsuites/validation/tc-ratemon-cancel.c b/testsuites/validation/tc-ratemon-cancel.c index 23d4383dcb..d8bce4de67 100644 --- a/testsuites/validation/tc-ratemon-cancel.c +++ b/testsuites/validation/tc-ratemon-cancel.c @@ -108,8 +108,6 @@ typedef enum { typedef enum { RtemsRatemonReqCancel_Post_Postponed_Zero, - RtemsRatemonReqCancel_Post_Postponed_One, - RtemsRatemonReqCancel_Post_Postponed_Several, RtemsRatemonReqCancel_Post_Postponed_Nop, RtemsRatemonReqCancel_Post_Postponed_NA } RtemsRatemonReqCancel_Post_Postponed; @@ -128,7 +126,7 @@ typedef struct { uint16_t Pre_Postponed_NA : 1; uint16_t Post_Status : 2; uint16_t Post_State : 2; - uint16_t Post_Postponed : 3; + uint16_t Post_Postponed : 2; uint16_t Post_Scheduler : 2; } RtemsRatemonReqCancel_Entry; @@ -557,27 +555,6 @@ static void RtemsRatemonReqCancel_Post_Postponed_Check( break; } - case RtemsRatemonReqCancel_Post_Postponed_One: { - /* - * The number of postponed jobs shall not be changed by the past call to - * rtems_rate_monotonic_cancel(). - */ - T_eq_u32( ctx->period_status.postponed_jobs_count, 1 ); - break; - } - - case RtemsRatemonReqCancel_Post_Postponed_Several: { - /* - * The number of postponed jobs shall not be changed by the past call to - * rtems_rate_monotonic_cancel(). - */ - T_eq_u32( - ctx->period_status.postponed_jobs_count, - ctx->postponed_jobs_count - ); - break; - } - case RtemsRatemonReqCancel_Post_Postponed_Nop: { /* * Objects referenced by the ``id`` parameter in past calls to @@ -753,6 +730,10 @@ RtemsRatemonReqCancel_Entries[] = { RtemsRatemonReqCancel_Post_State_NA, RtemsRatemonReqCancel_Post_Postponed_NA, RtemsRatemonReqCancel_Post_Scheduler_NA }, + { 0, 0, 0, 0, 0, RtemsRatemonReqCancel_Post_Status_Ok, + RtemsRatemonReqCancel_Post_State_Inactive, + RtemsRatemonReqCancel_Post_Postponed_Zero, + RtemsRatemonReqCancel_Post_Scheduler_Called }, { 0, 0, 0, 0, 0, RtemsRatemonReqCancel_Post_Status_NotOwn, RtemsRatemonReqCancel_Post_State_Nop, RtemsRatemonReqCancel_Post_Postponed_Nop, @@ -761,14 +742,6 @@ RtemsRatemonReqCancel_Entries[] = { RtemsRatemonReqCancel_Post_State_NA, RtemsRatemonReqCancel_Post_Postponed_NA, RtemsRatemonReqCancel_Post_Scheduler_NA }, - { 0, 0, 0, 0, 0, RtemsRatemonReqCancel_Post_Status_Ok, - RtemsRatemonReqCancel_Post_State_Inactive, - RtemsRatemonReqCancel_Post_Postponed_One, - RtemsRatemonReqCancel_Post_Scheduler_Called }, - { 0, 0, 0, 0, 0, RtemsRatemonReqCancel_Post_Status_Ok, - RtemsRatemonReqCancel_Post_State_Inactive, - RtemsRatemonReqCancel_Post_Postponed_Several, - RtemsRatemonReqCancel_Post_Scheduler_Called }, { 0, 0, 0, 0, 1, RtemsRatemonReqCancel_Post_Status_InvId, RtemsRatemonReqCancel_Post_State_Nop, RtemsRatemonReqCancel_Post_Postponed_Nop, @@ -777,10 +750,6 @@ RtemsRatemonReqCancel_Entries[] = { RtemsRatemonReqCancel_Post_State_Inactive, RtemsRatemonReqCancel_Post_Postponed_NA, RtemsRatemonReqCancel_Post_Scheduler_Called }, - { 0, 0, 0, 0, 0, RtemsRatemonReqCancel_Post_Status_Ok, - RtemsRatemonReqCancel_Post_State_Inactive, - RtemsRatemonReqCancel_Post_Postponed_Zero, - RtemsRatemonReqCancel_Post_Scheduler_Called }, { 0, 0, 0, 0, 1, RtemsRatemonReqCancel_Post_Status_NotOwn, RtemsRatemonReqCancel_Post_State_Nop, RtemsRatemonReqCancel_Post_Postponed_Nop, @@ -789,8 +758,8 @@ RtemsRatemonReqCancel_Entries[] = { static const uint8_t RtemsRatemonReqCancel_Map[] = { - 7, 1, 1, 8, 4, 5, 3, 4, 5, 9, 1, 1, 2, 2, 2, 3, 2, 2, 6, 1, 1, 0, 0, 0, 3, 0, - 0, 6, 1, 1, 0, 0, 0, 3, 0, 0 + 6, 1, 1, 2, 2, 2, 4, 2, 2, 7, 1, 1, 3, 3, 3, 4, 3, 3, 5, 1, 1, 0, 0, 0, 4, 0, + 0, 5, 1, 1, 0, 0, 0, 4, 0, 0 }; static size_t RtemsRatemonReqCancel_Scope( void *arg, char *buf, size_t n ) diff --git a/testsuites/validation/tc-ratemon-get-status.c b/testsuites/validation/tc-ratemon-get-status.c index 32e2fed118..fe3fb300e3 100644 --- a/testsuites/validation/tc-ratemon-get-status.c +++ b/testsuites/validation/tc-ratemon-get-status.c @@ -53,6 +53,7 @@ #endif #include +#include #include "tx-support.h" @@ -208,6 +209,12 @@ typedef struct { */ rtems_rate_monotonic_period_states previous_state; + /** + * @brief If the rtems_cpu_usage_reset() directive should be called before + * rtems_rate_monotonic_get_status(), this member contains a pointer to it. + */ + void (*do_reset)( void ); + /** * @brief This member contains the CLOCK_MONOTONIC time elapsed. */ @@ -829,9 +836,6 @@ static void RtemsRatemonReqGetStatus_Post_Postponed_Check( * Objects referenced by the ``status`` parameter in past calls to * rtems_rate_monotonic_get_status() shall not be accessed by the * rtems_rate_monotonic_get_status() call (see also Nop). - * - * Note: A newly created period has an arbitrary the number of postponed - * jobs because rtems_rate_monotonic_create() does not set this value 0. */ T_eq_u32( ctx->period_status.postponed_jobs_count, initial_postponed_jobs_count ); @@ -907,6 +911,9 @@ static void RtemsRatemonReqGetStatus_Action( RtemsRatemonReqGetStatus_Context *ctx ) { + if ( ctx->do_reset != NULL ) { + ctx->do_reset(); + } ctx->status = rtems_rate_monotonic_get_status( ctx->id_param, ctx->status_param @@ -955,8 +962,8 @@ RtemsRatemonReqGetStatus_Entries[] = { { 0, 0, 0, 0, 1, 1, 1, RtemsRatemonReqGetStatus_Post_Status_Ok, RtemsRatemonReqGetStatus_Post_Owner_OwnerTask, RtemsRatemonReqGetStatus_Post_State_Inactive, - RtemsRatemonReqGetStatus_Post_Elapsed_NA, - RtemsRatemonReqGetStatus_Post_Consumed_NA, + RtemsRatemonReqGetStatus_Post_Elapsed_Zero, + RtemsRatemonReqGetStatus_Post_Consumed_Zero, RtemsRatemonReqGetStatus_Post_Postponed_NA }, { 0, 0, 0, 0, 0, 0, 0, RtemsRatemonReqGetStatus_Post_Status_Ok, RtemsRatemonReqGetStatus_Post_Owner_OwnerTask, diff --git a/testsuites/validation/tc-ratemon-period.c b/testsuites/validation/tc-ratemon-period.c index 3385d76536..6055e8f976 100644 --- a/testsuites/validation/tc-ratemon-period.c +++ b/testsuites/validation/tc-ratemon-period.c @@ -667,6 +667,7 @@ static void RtemsRatemonReqPeriod_Pre_InactiveCause_Prepare( * parameter since that period object has been created. */ /* Nothing to do here as the period is newly created. */ + ctx->postponed_jobs_count = 0; break; } @@ -682,6 +683,7 @@ static void RtemsRatemonReqPeriod_Pre_InactiveCause_Prepare( TickTheClock( ctx, ctx->postponed_jobs_count * period_length ); } OwnerDoWork( ctx, CancelPeriod ); + ctx->postponed_jobs_count = 0; break; } @@ -831,9 +833,6 @@ static void RtemsRatemonReqPeriod_Post_Postponed_Check( * Objects referenced by the ``id`` parameter in past calls to * rtems_rate_monotonic_period() shall not be accessed by the * rtems_rate_monotonic_period() call (see also Nop). - * - * Note: A newly created period has an arbitrary the number of postponed - * jobs because rtems_rate_monotonic_create() does not set this value 0. */ T_eq_u32( ctx->period_status.postponed_jobs_count, @@ -1017,7 +1016,6 @@ static void RtemsRatemonReqPeriod_Prepare( RtemsRatemonReqPeriod_Context *ctx ) &period_status ); T_rsc_success( status ); - ctx->postponed_jobs_count = period_status.postponed_jobs_count; } static void RtemsRatemonReqPeriod_Action( RtemsRatemonReqPeriod_Context *ctx ) diff --git a/testsuites/validation/tc-ratemon-timeout.c b/testsuites/validation/tc-ratemon-timeout.c index 9025f9ec2b..b70a5cc85c 100644 --- a/testsuites/validation/tc-ratemon-timeout.c +++ b/testsuites/validation/tc-ratemon-timeout.c @@ -427,7 +427,7 @@ static void RtemsRatemonReqTimeout_Pre_WaitFor_Prepare( switch ( state ) { case RtemsRatemonReqTimeout_Pre_WaitFor_PeriodSelf: { /* - * While the owner of the period waits for the period. + * While the owner task of the period waits for the period. */ ctx->wait_for_period = true; ctx->period_is_other = false; @@ -436,7 +436,7 @@ static void RtemsRatemonReqTimeout_Pre_WaitFor_Prepare( case RtemsRatemonReqTimeout_Pre_WaitFor_PeriodOther: { /* - * While the owner of the period waits for another period. + * While the owner task of the period waits for another period. */ ctx->wait_for_period = true; ctx->period_is_other = true; @@ -445,7 +445,7 @@ static void RtemsRatemonReqTimeout_Pre_WaitFor_Prepare( case RtemsRatemonReqTimeout_Pre_WaitFor_Other: { /* - * While the owner of the period does not wait for a period. + * While the owner task of the period does not wait for a period. */ ctx->wait_for_period = false; break; @@ -464,7 +464,7 @@ static void RtemsRatemonReqTimeout_Pre_WaitState_Prepare( switch ( state ) { case RtemsRatemonReqTimeout_Pre_WaitState_Blocked: { /* - * While the owner is in the blocked wait state. + * While the owner task is in the blocked wait state. */ ctx->intend_to_block = false; break; @@ -472,7 +472,7 @@ static void RtemsRatemonReqTimeout_Pre_WaitState_Prepare( case RtemsRatemonReqTimeout_Pre_WaitState_IntendToBlock: { /* - * While the owner is in the intend to block wait state. + * While the owner task is in the intend to block wait state. */ ctx->intend_to_block = true; break; @@ -553,8 +553,9 @@ static void RtemsRatemonReqTimeout_Post_ReleaseJob_Check( switch ( state ) { case RtemsRatemonReqTimeout_Post_ReleaseJob_Yes: { /* - * The owner of the period shall release a job with a deadline equal to - * the clock tick plus the next period length by the timeout operation. + * The owner task of the period shall release a job with a deadline equal + * to the clock tick plus the next period length by the timeout + * operation. */ T_eq_u32( ctx->release_job_counter, 1 ); break; @@ -562,7 +563,7 @@ static void RtemsRatemonReqTimeout_Post_ReleaseJob_Check( case RtemsRatemonReqTimeout_Post_ReleaseJob_No: { /* - * The owner of the period shall not release a job by the timeout + * The owner task of the period shall not release a job by the timeout * operation. */ T_eq_u32( ctx->release_job_counter, 0 ); @@ -582,7 +583,8 @@ static void RtemsRatemonReqTimeout_Post_Unblock_Check( switch ( state ) { case RtemsRatemonReqTimeout_Post_Unblock_Yes: { /* - * The owner of the period shall be unblocked by the timeout operation. + * The owner task of the period shall be unblocked by the timeout + * operation. */ T_eq_u32( ctx->unblock_counter, 1 ); break; @@ -590,7 +592,7 @@ static void RtemsRatemonReqTimeout_Post_Unblock_Check( case RtemsRatemonReqTimeout_Post_Unblock_No: { /* - * The owner of the period shall not be unblocked by the timeout + * The owner task of the period shall not be unblocked by the timeout * operation. */ T_eq_u32( ctx->unblock_counter, 0 ); @@ -689,7 +691,7 @@ static void RtemsRatemonReqTimeout_Post_CPUUsage_Check( switch ( state ) { case RtemsRatemonReqTimeout_Post_CPUUsage_Nop: { /* - * The period initiated CPU usage of the owner value shall not be + * The period initiated CPU usage of the owner task value shall not be * modified. */ T_eq_i64( @@ -701,8 +703,8 @@ static void RtemsRatemonReqTimeout_Post_CPUUsage_Check( case RtemsRatemonReqTimeout_Post_CPUUsage_Set: { /* - * The period initiated CPU usage of the owner value shall be set to the - * CPU usage of the owner at some time point during the timeout + * The period initiated CPU usage of the owner task value shall be set to + * the CPU usage of the owner task at some time point during the timeout * operation. */ T_ne_i64( -- cgit v1.2.3