From a61e407c6ccbcce8555bf250df7ddfaec48a2729 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 29 Sep 2021 14:06:42 +0200 Subject: testsuites/validation/tc-sem-obtain.c --- testsuites/validation/tc-sem-obtain.c | 56 +++++++++++++++++++++++++++++------ 1 file changed, 47 insertions(+), 9 deletions(-) diff --git a/testsuites/validation/tc-sem-obtain.c b/testsuites/validation/tc-sem-obtain.c index f404be5dbd..b442e5397e 100644 --- a/testsuites/validation/tc-sem-obtain.c +++ b/testsuites/validation/tc-sem-obtain.c @@ -107,6 +107,8 @@ typedef enum { RtemsSemReqObtain_Post_Action_SemSeizeWait, RtemsSemReqObtain_Post_Action_MtxSeizeTry, RtemsSemReqObtain_Post_Action_MtxSeizeWait, + RtemsSemReqObtain_Post_Action_InheritMtxSeizeTry, + RtemsSemReqObtain_Post_Action_InheritMtxSeizeWait, RtemsSemReqObtain_Post_Action_CeilingMtxSeizeTry, RtemsSemReqObtain_Post_Action_CeilingMtxSeizeWait, RtemsSemReqObtain_Post_Action_MrsPMtxSeizeTry, @@ -410,10 +412,11 @@ static void RtemsSemReqObtain_Post_Action_Check( case RtemsSemReqObtain_Post_Action_MtxSeizeTry: { /* * The calling task shall try to seize the mutex as specified by - * /score/mtx/req/seize-try where an enqueue blocks and a recursive seize - * is allowed. + * /score/mtx/req/seize-try where an enqueue blocks, a recursive seize is + * allowed, and no locking protocol is used. */ ctx->tq_mtx_ctx.base.enqueue_variant = TQ_ENQUEUE_BLOCKS; + ctx->tq_mtx_ctx.protocol = TQ_MTX_NO_PROTOCOL; ctx->tq_mtx_ctx.recursive = TQ_MTX_RECURSIVE_ALLOWED; ctx->tq_mtx_ctx.priority_ceiling = PRIO_INVALID; ScoreMtxReqSeizeTry_Run( &ctx->tq_mtx_ctx ); @@ -423,10 +426,39 @@ static void RtemsSemReqObtain_Post_Action_Check( case RtemsSemReqObtain_Post_Action_MtxSeizeWait: { /* * The calling task shall wait to seize the mutex as specified by - * /score/mtx/req/seize-wait where an enqueue blocks and a recursive - * seize is allowed. + * /score/mtx/req/seize-wait where an enqueue blocks, a recursive seize + * is allowed, and no locking protocol is used. + */ + ctx->tq_mtx_ctx.base.enqueue_variant = TQ_ENQUEUE_BLOCKS; + ctx->tq_mtx_ctx.protocol = TQ_MTX_NO_PROTOCOL; + ctx->tq_mtx_ctx.recursive = TQ_MTX_RECURSIVE_ALLOWED; + ctx->tq_mtx_ctx.priority_ceiling = PRIO_INVALID; + ScoreMtxReqSeizeWait_Run( &ctx->tq_mtx_ctx ); + break; + } + + case RtemsSemReqObtain_Post_Action_InheritMtxSeizeTry: { + /* + * The calling task shall try to seize the mutex as specified by + * /score/mtx/req/seize-try where an enqueue blocks, a recursive seize is + * allowed, and a priority inheritance protocol is used. + */ + ctx->tq_mtx_ctx.base.enqueue_variant = TQ_ENQUEUE_BLOCKS; + ctx->tq_mtx_ctx.protocol = TQ_MTX_NO_PROTOCOL; + ctx->tq_mtx_ctx.recursive = TQ_MTX_RECURSIVE_ALLOWED; + ctx->tq_mtx_ctx.priority_ceiling = PRIO_INVALID; + ScoreMtxReqSeizeTry_Run( &ctx->tq_mtx_ctx ); + break; + } + + case RtemsSemReqObtain_Post_Action_InheritMtxSeizeWait: { + /* + * The calling task shall wait to seize the mutex as specified by + * /score/mtx/req/seize-wait where an enqueue blocks, a recursive seize + * is allowed, and a priority inheritance protocol is used. */ ctx->tq_mtx_ctx.base.enqueue_variant = TQ_ENQUEUE_BLOCKS; + ctx->tq_mtx_ctx.protocol = TQ_MTX_NO_PROTOCOL; ctx->tq_mtx_ctx.recursive = TQ_MTX_RECURSIVE_ALLOWED; ctx->tq_mtx_ctx.priority_ceiling = PRIO_INVALID; ScoreMtxReqSeizeWait_Run( &ctx->tq_mtx_ctx ); @@ -440,6 +472,7 @@ static void RtemsSemReqObtain_Post_Action_Check( * allowed, and a priority ceiling is used. */ ctx->tq_mtx_ctx.base.enqueue_variant = TQ_ENQUEUE_BLOCKS; + ctx->tq_mtx_ctx.protocol = TQ_MTX_PRIORITY_CEILING; ctx->tq_mtx_ctx.recursive = TQ_MTX_RECURSIVE_ALLOWED; ctx->tq_mtx_ctx.priority_ceiling = PRIO_VERY_HIGH; ScoreMtxReqSeizeTry_Run( &ctx->tq_mtx_ctx ); @@ -453,6 +486,7 @@ static void RtemsSemReqObtain_Post_Action_Check( * is allowed, and a priority ceiling is used. */ ctx->tq_mtx_ctx.base.enqueue_variant = TQ_ENQUEUE_BLOCKS; + ctx->tq_mtx_ctx.protocol = TQ_MTX_PRIORITY_CEILING; ctx->tq_mtx_ctx.recursive = TQ_MTX_RECURSIVE_ALLOWED; ctx->tq_mtx_ctx.priority_ceiling = PRIO_VERY_HIGH; ScoreMtxReqSeizeWait_Run( &ctx->tq_mtx_ctx ); @@ -466,6 +500,7 @@ static void RtemsSemReqObtain_Post_Action_Check( * returns an error status, and a priority ceiling is used. */ ctx->tq_mtx_ctx.base.enqueue_variant = TQ_ENQUEUE_STICKY; + ctx->tq_mtx_ctx.protocol = TQ_MTX_MRSP; ctx->tq_mtx_ctx.recursive = TQ_MTX_RECURSIVE_DEADLOCK; ctx->tq_mtx_ctx.priority_ceiling = PRIO_VERY_HIGH; ScoreMtxReqSeizeTry_Run( &ctx->tq_mtx_ctx ); @@ -479,6 +514,7 @@ static void RtemsSemReqObtain_Post_Action_Check( * seize returns an error status, and a priority ceiling is used. */ ctx->tq_mtx_ctx.base.enqueue_variant = TQ_ENQUEUE_STICKY; + ctx->tq_mtx_ctx.protocol = TQ_MTX_MRSP; ctx->tq_mtx_ctx.recursive = TQ_MTX_RECURSIVE_DEADLOCK; ctx->tq_mtx_ctx.priority_ceiling = PRIO_VERY_HIGH; ScoreMtxReqSeizeWait_Run( &ctx->tq_mtx_ctx ); @@ -568,21 +604,23 @@ RtemsSemReqObtain_Entries[] = { { 0, 0, 0, 0, 0, RtemsSemReqObtain_Post_Action_InvId }, { 1, 0, 0, 0, 0, RtemsSemReqObtain_Post_Action_NA }, { 0, 0, 0, 0, 0, RtemsSemReqObtain_Post_Action_SemSeizeWait }, - { 0, 0, 0, 0, 0, RtemsSemReqObtain_Post_Action_MtxSeizeWait }, { 0, 0, 0, 0, 0, RtemsSemReqObtain_Post_Action_SemSeizeTry }, - { 0, 0, 0, 0, 0, RtemsSemReqObtain_Post_Action_MtxSeizeTry }, + { 0, 0, 0, 0, 0, RtemsSemReqObtain_Post_Action_MtxSeizeWait }, #if defined(RTEMS_SMP) { 0, 0, 0, 0, 0, RtemsSemReqObtain_Post_Action_InvId }, #else { 1, 0, 0, 0, 0, RtemsSemReqObtain_Post_Action_NA }, #endif + { 0, 0, 0, 0, 0, RtemsSemReqObtain_Post_Action_MtxSeizeTry }, { 0, 0, 0, 0, 0, RtemsSemReqObtain_Post_Action_CeilingMtxSeizeWait }, + { 0, 0, 0, 0, 0, RtemsSemReqObtain_Post_Action_InheritMtxSeizeWait }, #if defined(RTEMS_SMP) { 0, 0, 0, 0, 0, RtemsSemReqObtain_Post_Action_MrsPMtxSeizeWait }, #else { 1, 0, 0, 0, 0, RtemsSemReqObtain_Post_Action_NA }, #endif { 0, 0, 0, 0, 0, RtemsSemReqObtain_Post_Action_CeilingMtxSeizeTry }, + { 0, 0, 0, 0, 0, RtemsSemReqObtain_Post_Action_InheritMtxSeizeTry }, #if defined(RTEMS_SMP) { 0, 0, 0, 0, 0, RtemsSemReqObtain_Post_Action_MrsPMtxSeizeTry } #else @@ -592,9 +630,9 @@ RtemsSemReqObtain_Entries[] = { static const uint8_t RtemsSemReqObtain_Map[] = { - 4, 2, 2, 0, 0, 0, 4, 2, 2, 0, 0, 0, 4, 2, 2, 0, 0, 0, 4, 2, 2, 0, 0, 0, 5, 3, - 3, 0, 0, 0, 5, 3, 3, 0, 0, 0, 1, 1, 1, 1, 1, 1, 9, 7, 7, 0, 0, 0, 1, 1, 1, 1, - 1, 1, 5, 3, 3, 0, 0, 0, 1, 1, 1, 1, 1, 1, 10, 8, 8, 6, 6, 6 + 3, 2, 2, 0, 0, 0, 3, 2, 2, 0, 0, 0, 3, 2, 2, 0, 0, 0, 3, 2, 2, 0, 0, 0, 6, 4, + 4, 0, 0, 0, 6, 4, 4, 0, 0, 0, 1, 1, 1, 1, 1, 1, 10, 7, 7, 0, 0, 0, 1, 1, 1, + 1, 1, 1, 11, 8, 8, 0, 0, 0, 1, 1, 1, 1, 1, 1, 12, 9, 9, 5, 5, 5 }; static size_t RtemsSemReqObtain_Scope( void *arg, char *buf, size_t n ) -- cgit v1.2.3