Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:52

0001 /* SPDX-License-Identifier: BSD-2-Clause */
0002 
0003 /**
0004  * @file
0005  *
0006  * @ingroup RtemsTaskReqSetPriority
0007  */
0008 
0009 /*
0010  * Copyright (C) 2021 embedded brains GmbH & Co. KG
0011  *
0012  * Redistribution and use in source and binary forms, with or without
0013  * modification, are permitted provided that the following conditions
0014  * are met:
0015  * 1. Redistributions of source code must retain the above copyright
0016  *    notice, this list of conditions and the following disclaimer.
0017  * 2. Redistributions in binary form must reproduce the above copyright
0018  *    notice, this list of conditions and the following disclaimer in the
0019  *    documentation and/or other materials provided with the distribution.
0020  *
0021  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0022  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0023  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0024  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0025  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0026  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0027  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0028  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0029  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0030  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0031  * POSSIBILITY OF SUCH DAMAGE.
0032  */
0033 
0034 /*
0035  * This file is part of the RTEMS quality process and was automatically
0036  * generated.  If you find something that needs to be fixed or
0037  * worded better please post a report or patch to an RTEMS mailing list
0038  * or raise a bug report:
0039  *
0040  * https://www.rtems.org/bugs.html
0041  *
0042  * For information on updating and regenerating please refer to the How-To
0043  * section in the Software Requirements Engineering chapter of the
0044  * RTEMS Software Engineering manual.  The manual is provided as a part of
0045  * a release.  For development sources please refer to the online
0046  * documentation at:
0047  *
0048  * https://docs.rtems.org
0049  */
0050 
0051 #ifdef HAVE_CONFIG_H
0052 #include "config.h"
0053 #endif
0054 
0055 #include <rtems.h>
0056 
0057 #include "tx-support.h"
0058 
0059 #include <rtems/test.h>
0060 
0061 /**
0062  * @defgroup RtemsTaskReqSetPriority spec:/rtems/task/req/set-priority
0063  *
0064  * @ingroup TestsuitesValidationNoClock0
0065  * @ingroup TestsuitesValidationOneCpu0
0066  *
0067  * @{
0068  */
0069 
0070 typedef enum {
0071   RtemsTaskReqSetPriority_Pre_Id_Invalid,
0072   RtemsTaskReqSetPriority_Pre_Id_Task,
0073   RtemsTaskReqSetPriority_Pre_Id_NA
0074 } RtemsTaskReqSetPriority_Pre_Id;
0075 
0076 typedef enum {
0077   RtemsTaskReqSetPriority_Pre_State_Dormant,
0078   RtemsTaskReqSetPriority_Pre_State_Ready,
0079   RtemsTaskReqSetPriority_Pre_State_Scheduled,
0080   RtemsTaskReqSetPriority_Pre_State_Blocked,
0081   RtemsTaskReqSetPriority_Pre_State_NA
0082 } RtemsTaskReqSetPriority_Pre_State;
0083 
0084 typedef enum {
0085   RtemsTaskReqSetPriority_Pre_NewPriority_Current,
0086   RtemsTaskReqSetPriority_Pre_NewPriority_Other,
0087   RtemsTaskReqSetPriority_Pre_NewPriority_NA
0088 } RtemsTaskReqSetPriority_Pre_NewPriority;
0089 
0090 typedef enum {
0091   RtemsTaskReqSetPriority_Pre_TaskPriority_High,
0092   RtemsTaskReqSetPriority_Pre_TaskPriority_Equal,
0093   RtemsTaskReqSetPriority_Pre_TaskPriority_Low,
0094   RtemsTaskReqSetPriority_Pre_TaskPriority_Invalid,
0095   RtemsTaskReqSetPriority_Pre_TaskPriority_NA
0096 } RtemsTaskReqSetPriority_Pre_TaskPriority;
0097 
0098 typedef enum {
0099   RtemsTaskReqSetPriority_Pre_OldPriority_Valid,
0100   RtemsTaskReqSetPriority_Pre_OldPriority_Null,
0101   RtemsTaskReqSetPriority_Pre_OldPriority_NA
0102 } RtemsTaskReqSetPriority_Pre_OldPriority;
0103 
0104 typedef enum {
0105   RtemsTaskReqSetPriority_Post_Status_Ok,
0106   RtemsTaskReqSetPriority_Post_Status_InvAddr,
0107   RtemsTaskReqSetPriority_Post_Status_InvId,
0108   RtemsTaskReqSetPriority_Post_Status_InvPrio,
0109   RtemsTaskReqSetPriority_Post_Status_NA
0110 } RtemsTaskReqSetPriority_Post_Status;
0111 
0112 typedef enum {
0113   RtemsTaskReqSetPriority_Post_Priority_Set,
0114   RtemsTaskReqSetPriority_Post_Priority_Nop,
0115   RtemsTaskReqSetPriority_Post_Priority_NA
0116 } RtemsTaskReqSetPriority_Post_Priority;
0117 
0118 typedef enum {
0119   RtemsTaskReqSetPriority_Post_OldPriorityObj_Set,
0120   RtemsTaskReqSetPriority_Post_OldPriorityObj_Nop,
0121   RtemsTaskReqSetPriority_Post_OldPriorityObj_NA
0122 } RtemsTaskReqSetPriority_Post_OldPriorityObj;
0123 
0124 typedef struct {
0125   uint16_t Skip : 1;
0126   uint16_t Pre_Id_NA : 1;
0127   uint16_t Pre_State_NA : 1;
0128   uint16_t Pre_NewPriority_NA : 1;
0129   uint16_t Pre_TaskPriority_NA : 1;
0130   uint16_t Pre_OldPriority_NA : 1;
0131   uint16_t Post_Status : 3;
0132   uint16_t Post_Priority : 2;
0133   uint16_t Post_OldPriorityObj : 2;
0134 } RtemsTaskReqSetPriority_Entry;
0135 
0136 /**
0137  * @brief Test context for spec:/rtems/task/req/set-priority test case.
0138  */
0139 typedef struct {
0140   /**
0141    * @brief This member contains the worker task identifier.
0142    */
0143   rtems_id worker_id;
0144 
0145   /**
0146    * @brief If this member is true, then the task shall be started.
0147    */
0148   bool started;
0149 
0150   /**
0151    * @brief If this member is true, then the task shall be blocked.
0152    */
0153   bool blocked;
0154 
0155   /**
0156    * @brief This member provides the object referenced by the ``old_priority``
0157    *   parameter.
0158    */
0159   rtems_task_priority old_priority_obj;
0160 
0161   /**
0162    * @brief This member contains the return value of the
0163    *   rtems_task_set_priority() call.
0164    */
0165   rtems_status_code status;
0166 
0167   /**
0168    * @brief This member specifies if the ``id`` parameter value.
0169    */
0170   rtems_id id;
0171 
0172   /**
0173    * @brief This member specifies if the ``new_priority`` parameter value.
0174    */
0175   rtems_task_priority new_priority;
0176 
0177   /**
0178    * @brief This member specifies if the ``old_priority`` parameter value.
0179    */
0180   rtems_task_priority *old_priority;
0181 
0182   struct {
0183     /**
0184      * @brief This member defines the pre-condition indices for the next
0185      *   action.
0186      */
0187     size_t pci[ 5 ];
0188 
0189     /**
0190      * @brief This member defines the pre-condition states for the next action.
0191      */
0192     size_t pcs[ 5 ];
0193 
0194     /**
0195      * @brief If this member is true, then the test action loop is executed.
0196      */
0197     bool in_action_loop;
0198 
0199     /**
0200      * @brief This member contains the next transition map index.
0201      */
0202     size_t index;
0203 
0204     /**
0205      * @brief This member contains the current transition map entry.
0206      */
0207     RtemsTaskReqSetPriority_Entry entry;
0208 
0209     /**
0210      * @brief If this member is true, then the current transition variant
0211      *   should be skipped.
0212      */
0213     bool skip;
0214   } Map;
0215 } RtemsTaskReqSetPriority_Context;
0216 
0217 static RtemsTaskReqSetPriority_Context
0218   RtemsTaskReqSetPriority_Instance;
0219 
0220 static const char * const RtemsTaskReqSetPriority_PreDesc_Id[] = {
0221   "Invalid",
0222   "Task",
0223   "NA"
0224 };
0225 
0226 static const char * const RtemsTaskReqSetPriority_PreDesc_State[] = {
0227   "Dormant",
0228   "Ready",
0229   "Scheduled",
0230   "Blocked",
0231   "NA"
0232 };
0233 
0234 static const char * const RtemsTaskReqSetPriority_PreDesc_NewPriority[] = {
0235   "Current",
0236   "Other",
0237   "NA"
0238 };
0239 
0240 static const char * const RtemsTaskReqSetPriority_PreDesc_TaskPriority[] = {
0241   "High",
0242   "Equal",
0243   "Low",
0244   "Invalid",
0245   "NA"
0246 };
0247 
0248 static const char * const RtemsTaskReqSetPriority_PreDesc_OldPriority[] = {
0249   "Valid",
0250   "Null",
0251   "NA"
0252 };
0253 
0254 static const char * const * const RtemsTaskReqSetPriority_PreDesc[] = {
0255   RtemsTaskReqSetPriority_PreDesc_Id,
0256   RtemsTaskReqSetPriority_PreDesc_State,
0257   RtemsTaskReqSetPriority_PreDesc_NewPriority,
0258   RtemsTaskReqSetPriority_PreDesc_TaskPriority,
0259   RtemsTaskReqSetPriority_PreDesc_OldPriority,
0260   NULL
0261 };
0262 
0263 static void Worker( rtems_task_argument arg )
0264 {
0265   (void) ReceiveAnyEvents();
0266   (void) ReceiveAnyEvents();
0267 }
0268 
0269 static void RtemsTaskReqSetPriority_Pre_Id_Prepare(
0270   RtemsTaskReqSetPriority_Context *ctx,
0271   RtemsTaskReqSetPriority_Pre_Id   state
0272 )
0273 {
0274   switch ( state ) {
0275     case RtemsTaskReqSetPriority_Pre_Id_Invalid: {
0276       /*
0277        * While the ``id`` parameter is not associated with a task.
0278        */
0279       ctx->id = INVALID_ID;
0280       break;
0281     }
0282 
0283     case RtemsTaskReqSetPriority_Pre_Id_Task: {
0284       /*
0285        * While the ``id`` parameter is associated with a task.
0286        */
0287       ctx->id = ctx->worker_id;
0288       break;
0289     }
0290 
0291     case RtemsTaskReqSetPriority_Pre_Id_NA:
0292       break;
0293   }
0294 }
0295 
0296 static void RtemsTaskReqSetPriority_Pre_State_Prepare(
0297   RtemsTaskReqSetPriority_Context  *ctx,
0298   RtemsTaskReqSetPriority_Pre_State state
0299 )
0300 {
0301   switch ( state ) {
0302     case RtemsTaskReqSetPriority_Pre_State_Dormant: {
0303       /*
0304        * While the task specified by the ``id`` parameter is dormant.
0305        */
0306       ctx->started = false;
0307       break;
0308     }
0309 
0310     case RtemsTaskReqSetPriority_Pre_State_Ready: {
0311       /*
0312        * While the task specified by the ``id`` parameter is ready.
0313        */
0314       ctx->started = true;
0315       ctx->blocked = false;
0316       break;
0317     }
0318 
0319     case RtemsTaskReqSetPriority_Pre_State_Scheduled: {
0320       /*
0321        * While the task specified by the ``id`` parameter is scheduled.
0322        */
0323       ctx->started = false;
0324       ctx->id = rtems_task_self();
0325       break;
0326     }
0327 
0328     case RtemsTaskReqSetPriority_Pre_State_Blocked: {
0329       /*
0330        * While the task specified by the ``id`` parameter is blocked.
0331        */
0332       ctx->started = true;
0333       ctx->blocked = true;
0334       break;
0335     }
0336 
0337     case RtemsTaskReqSetPriority_Pre_State_NA:
0338       break;
0339   }
0340 }
0341 
0342 static void RtemsTaskReqSetPriority_Pre_NewPriority_Prepare(
0343   RtemsTaskReqSetPriority_Context        *ctx,
0344   RtemsTaskReqSetPriority_Pre_NewPriority state
0345 )
0346 {
0347   switch ( state ) {
0348     case RtemsTaskReqSetPriority_Pre_NewPriority_Current: {
0349       /*
0350        * While the value of the ``new_priority`` parameter is equal to
0351        * RTEMS_CURRENT_PRIORITY.
0352        */
0353       ctx->new_priority = RTEMS_CURRENT_PRIORITY;
0354       break;
0355     }
0356 
0357     case RtemsTaskReqSetPriority_Pre_NewPriority_Other: {
0358       /*
0359        * While the value of the ``new_priority`` parameter is not equal to
0360        * RTEMS_CURRENT_PRIORITY.
0361        */
0362       ctx->new_priority = PRIO_NORMAL;
0363       break;
0364     }
0365 
0366     case RtemsTaskReqSetPriority_Pre_NewPriority_NA:
0367       break;
0368   }
0369 }
0370 
0371 static void RtemsTaskReqSetPriority_Pre_TaskPriority_Prepare(
0372   RtemsTaskReqSetPriority_Context         *ctx,
0373   RtemsTaskReqSetPriority_Pre_TaskPriority state
0374 )
0375 {
0376   switch ( state ) {
0377     case RtemsTaskReqSetPriority_Pre_TaskPriority_High: {
0378       /*
0379        * While the value of the ``new_priority`` parameter is a valid task
0380        * priority with respect to the home scheduler of the task specified by
0381        * the ``id`` parameter when the new priority is set, while the value of
0382        * the ``new_priority`` parameter is higher than the task priority with
0383        * respect to the home scheduler of the task specified by the ``id``
0384        * parameter at time when the scheduler evaluates the new priority.
0385        */
0386       ctx->new_priority = PRIO_HIGH;
0387       break;
0388     }
0389 
0390     case RtemsTaskReqSetPriority_Pre_TaskPriority_Equal: {
0391       /*
0392        * While the value of the ``new_priority`` parameter is a valid task
0393        * priority with respect to the home scheduler of the task specified by
0394        * the ``id`` parameter when the new priority is set, while the value of
0395        * the ``new_priority`` parameter is equal to the task priority with
0396        * respect to the home scheduler of the task specified by the ``id``
0397        * parameter at time when the scheduler evaluates the new priority.
0398        */
0399       ctx->new_priority = PRIO_NORMAL;
0400       break;
0401     }
0402 
0403     case RtemsTaskReqSetPriority_Pre_TaskPriority_Low: {
0404       /*
0405        * While the value of the ``new_priority`` parameter is a valid task
0406        * priority with respect to the home scheduler of the task specified by
0407        * the ``id`` parameter when the new priority is set, while the value of
0408        * the ``new_priority`` parameter is lower than the task priority with
0409        * respect to the home scheduler of the task specified by the ``id``
0410        * parameter at time when the scheduler evaluates the new priority.
0411        */
0412       ctx->new_priority = PRIO_LOW;
0413       break;
0414     }
0415 
0416     case RtemsTaskReqSetPriority_Pre_TaskPriority_Invalid: {
0417       /*
0418        * While the value of the ``new_priority`` parameter is an invalid task
0419        * priority with respect to the home scheduler of the task specified by
0420        * the ``id`` parameter when the new priority is evaluated.
0421        */
0422       ctx->new_priority = PRIO_INVALID;
0423       break;
0424     }
0425 
0426     case RtemsTaskReqSetPriority_Pre_TaskPriority_NA:
0427       break;
0428   }
0429 }
0430 
0431 static void RtemsTaskReqSetPriority_Pre_OldPriority_Prepare(
0432   RtemsTaskReqSetPriority_Context        *ctx,
0433   RtemsTaskReqSetPriority_Pre_OldPriority state
0434 )
0435 {
0436   switch ( state ) {
0437     case RtemsTaskReqSetPriority_Pre_OldPriority_Valid: {
0438       /*
0439        * While the ``old_priority`` parameter references an object of type
0440        * rtems_task_priority.
0441        */
0442       ctx->old_priority = &ctx->old_priority_obj;
0443       break;
0444     }
0445 
0446     case RtemsTaskReqSetPriority_Pre_OldPriority_Null: {
0447       /*
0448        * While the ``old_priority`` parameter is equal to NULL.
0449        */
0450       ctx->old_priority = NULL;
0451       break;
0452     }
0453 
0454     case RtemsTaskReqSetPriority_Pre_OldPriority_NA:
0455       break;
0456   }
0457 }
0458 
0459 static void RtemsTaskReqSetPriority_Post_Status_Check(
0460   RtemsTaskReqSetPriority_Context    *ctx,
0461   RtemsTaskReqSetPriority_Post_Status state
0462 )
0463 {
0464   switch ( state ) {
0465     case RtemsTaskReqSetPriority_Post_Status_Ok: {
0466       /*
0467        * The return status of rtems_task_set_priority() shall be
0468        * RTEMS_SUCCESSFUL.
0469        */
0470       T_rsc_success( ctx->status );
0471       break;
0472     }
0473 
0474     case RtemsTaskReqSetPriority_Post_Status_InvAddr: {
0475       /*
0476        * The return status of rtems_task_set_priority() shall be
0477        * RTEMS_INVALID_ADDRESS.
0478        */
0479       T_rsc( ctx->status, RTEMS_INVALID_ADDRESS );
0480       break;
0481     }
0482 
0483     case RtemsTaskReqSetPriority_Post_Status_InvId: {
0484       /*
0485        * The return status of rtems_task_set_priority() shall be
0486        * RTEMS_INVALID_ID.
0487        */
0488       T_rsc( ctx->status, RTEMS_INVALID_ID );
0489       break;
0490     }
0491 
0492     case RtemsTaskReqSetPriority_Post_Status_InvPrio: {
0493       /*
0494        * The return status of rtems_task_set_priority() shall be
0495        * RTEMS_INVALID_PRIORITY.
0496        */
0497       T_rsc( ctx->status, RTEMS_INVALID_PRIORITY );
0498       break;
0499     }
0500 
0501     case RtemsTaskReqSetPriority_Post_Status_NA:
0502       break;
0503   }
0504 }
0505 
0506 static void RtemsTaskReqSetPriority_Post_Priority_Check(
0507   RtemsTaskReqSetPriority_Context      *ctx,
0508   RtemsTaskReqSetPriority_Post_Priority state
0509 )
0510 {
0511   switch ( state ) {
0512     case RtemsTaskReqSetPriority_Post_Priority_Set: {
0513       /*
0514        * The real priority of the task specified by the ``id`` parameter shall
0515        * be set to the value specified by the ``new_priority`` parameter at
0516        * some point during the rtems_task_set_priority() call.
0517        */
0518       T_eq_u32( GetPriority( ctx->id ), ctx->new_priority );
0519       break;
0520     }
0521 
0522     case RtemsTaskReqSetPriority_Post_Priority_Nop: {
0523       /*
0524        * No real priority of a task shall be modified by the
0525        * rtems_task_set_priority() call.
0526        */
0527       T_eq_u32( GetPriority( ctx->worker_id ), PRIO_NORMAL );
0528       break;
0529     }
0530 
0531     case RtemsTaskReqSetPriority_Post_Priority_NA:
0532       break;
0533   }
0534 }
0535 
0536 static void RtemsTaskReqSetPriority_Post_OldPriorityObj_Check(
0537   RtemsTaskReqSetPriority_Context            *ctx,
0538   RtemsTaskReqSetPriority_Post_OldPriorityObj state
0539 )
0540 {
0541   switch ( state ) {
0542     case RtemsTaskReqSetPriority_Post_OldPriorityObj_Set: {
0543       /*
0544        * The value of the object referenced by the ``old_priority`` parameter
0545        * shall be set after the return of the rtems_task_set_priority() call to
0546        * the current priority of the task specified by the ``id`` parameter at
0547        * some point during the call and before the real priority is modified by
0548        * the call if it is modified by the call.
0549        */
0550       T_eq_u32( ctx->old_priority_obj, PRIO_NORMAL );
0551       break;
0552     }
0553 
0554     case RtemsTaskReqSetPriority_Post_OldPriorityObj_Nop: {
0555       /*
0556        * Objects referenced by the ``old_priority`` parameter in past calls to
0557        * rtems_task_set_priority() shall not be accessed by the
0558        * rtems_task_set_priority() call.
0559        */
0560       T_eq_u32( ctx->old_priority_obj, PRIO_INVALID );
0561       break;
0562     }
0563 
0564     case RtemsTaskReqSetPriority_Post_OldPriorityObj_NA:
0565       break;
0566   }
0567 }
0568 
0569 static void RtemsTaskReqSetPriority_Setup(
0570   RtemsTaskReqSetPriority_Context *ctx
0571 )
0572 {
0573   SetSelfPriority( PRIO_ULTRA_HIGH );
0574 }
0575 
0576 static void RtemsTaskReqSetPriority_Setup_Wrap( void *arg )
0577 {
0578   RtemsTaskReqSetPriority_Context *ctx;
0579 
0580   ctx = arg;
0581   ctx->Map.in_action_loop = false;
0582   RtemsTaskReqSetPriority_Setup( ctx );
0583 }
0584 
0585 static void RtemsTaskReqSetPriority_Teardown(
0586   RtemsTaskReqSetPriority_Context *ctx
0587 )
0588 {
0589   RestoreRunnerPriority();
0590 }
0591 
0592 static void RtemsTaskReqSetPriority_Teardown_Wrap( void *arg )
0593 {
0594   RtemsTaskReqSetPriority_Context *ctx;
0595 
0596   ctx = arg;
0597   ctx->Map.in_action_loop = false;
0598   RtemsTaskReqSetPriority_Teardown( ctx );
0599 }
0600 
0601 static void RtemsTaskReqSetPriority_Prepare(
0602   RtemsTaskReqSetPriority_Context *ctx
0603 )
0604 {
0605   ctx->old_priority_obj = PRIO_INVALID;
0606   ctx->worker_id = CreateTask( "WORK", PRIO_NORMAL );
0607   ctx->started = false;
0608   ctx->blocked = false;
0609 }
0610 
0611 static void RtemsTaskReqSetPriority_Action(
0612   RtemsTaskReqSetPriority_Context *ctx
0613 )
0614 {
0615   if ( ctx->started ) {
0616     SetSelfPriority( PRIO_ULTRA_HIGH );
0617     StartTask( ctx->worker_id, Worker, NULL );
0618 
0619     if ( ctx->blocked ) {
0620       SetSelfPriority( PRIO_ULTRA_LOW );
0621       SetSelfPriority( PRIO_ULTRA_HIGH );
0622     }
0623   } else {
0624     SetSelfPriority( PRIO_NORMAL );
0625   }
0626 
0627   ctx->status = rtems_task_set_priority(
0628     ctx->id,
0629     ctx->new_priority,
0630     ctx->old_priority
0631   );
0632 
0633   if ( ctx->started ) {
0634     SendEvents( ctx->worker_id, RTEMS_EVENT_0 );
0635     SetSelfPriority( PRIO_ULTRA_LOW );
0636     SetSelfPriority( PRIO_ULTRA_HIGH );
0637   }
0638 }
0639 
0640 static void RtemsTaskReqSetPriority_Cleanup(
0641   RtemsTaskReqSetPriority_Context *ctx
0642 )
0643 {
0644   DeleteTask( ctx->worker_id );
0645 }
0646 
0647 static const RtemsTaskReqSetPriority_Entry
0648 RtemsTaskReqSetPriority_Entries[] = {
0649   { 0, 0, 1, 0, 1, 0, RtemsTaskReqSetPriority_Post_Status_InvId,
0650     RtemsTaskReqSetPriority_Post_Priority_Nop,
0651     RtemsTaskReqSetPriority_Post_OldPriorityObj_Nop },
0652   { 0, 0, 1, 0, 1, 0, RtemsTaskReqSetPriority_Post_Status_InvAddr,
0653     RtemsTaskReqSetPriority_Post_Priority_Nop,
0654     RtemsTaskReqSetPriority_Post_OldPriorityObj_Nop },
0655   { 0, 0, 0, 0, 1, 0, RtemsTaskReqSetPriority_Post_Status_Ok,
0656     RtemsTaskReqSetPriority_Post_Priority_Nop,
0657     RtemsTaskReqSetPriority_Post_OldPriorityObj_Set },
0658   { 0, 0, 0, 0, 1, 0, RtemsTaskReqSetPriority_Post_Status_InvAddr,
0659     RtemsTaskReqSetPriority_Post_Priority_Nop,
0660     RtemsTaskReqSetPriority_Post_OldPriorityObj_Nop },
0661   { 0, 0, 0, 0, 0, 0, RtemsTaskReqSetPriority_Post_Status_InvAddr,
0662     RtemsTaskReqSetPriority_Post_Priority_Nop,
0663     RtemsTaskReqSetPriority_Post_OldPriorityObj_Nop },
0664   { 0, 0, 0, 0, 0, 0, RtemsTaskReqSetPriority_Post_Status_Ok,
0665     RtemsTaskReqSetPriority_Post_Priority_Set,
0666     RtemsTaskReqSetPriority_Post_OldPriorityObj_Set },
0667   { 0, 0, 0, 0, 0, 0, RtemsTaskReqSetPriority_Post_Status_InvPrio,
0668     RtemsTaskReqSetPriority_Post_Priority_Nop,
0669     RtemsTaskReqSetPriority_Post_OldPriorityObj_Set }
0670 };
0671 
0672 static const uint8_t
0673 RtemsTaskReqSetPriority_Map[] = {
0674   0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
0675   0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
0676   0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 2, 3, 2, 3, 2, 3, 2, 3, 5, 4, 5, 4, 5, 4,
0677   6, 4, 2, 3, 2, 3, 2, 3, 2, 3, 5, 4, 5, 4, 5, 4, 6, 4, 2, 3, 2, 3, 2, 3, 2, 3,
0678   5, 4, 5, 4, 5, 4, 6, 4, 2, 3, 2, 3, 2, 3, 2, 3, 5, 4, 5, 4, 5, 4, 6, 4
0679 };
0680 
0681 static size_t RtemsTaskReqSetPriority_Scope( void *arg, char *buf, size_t n )
0682 {
0683   RtemsTaskReqSetPriority_Context *ctx;
0684 
0685   ctx = arg;
0686 
0687   if ( ctx->Map.in_action_loop ) {
0688     return T_get_scope(
0689       RtemsTaskReqSetPriority_PreDesc,
0690       buf,
0691       n,
0692       ctx->Map.pcs
0693     );
0694   }
0695 
0696   return 0;
0697 }
0698 
0699 static T_fixture RtemsTaskReqSetPriority_Fixture = {
0700   .setup = RtemsTaskReqSetPriority_Setup_Wrap,
0701   .stop = NULL,
0702   .teardown = RtemsTaskReqSetPriority_Teardown_Wrap,
0703   .scope = RtemsTaskReqSetPriority_Scope,
0704   .initial_context = &RtemsTaskReqSetPriority_Instance
0705 };
0706 
0707 static inline RtemsTaskReqSetPriority_Entry RtemsTaskReqSetPriority_PopEntry(
0708   RtemsTaskReqSetPriority_Context *ctx
0709 )
0710 {
0711   size_t index;
0712 
0713   index = ctx->Map.index;
0714   ctx->Map.index = index + 1;
0715   return RtemsTaskReqSetPriority_Entries[
0716     RtemsTaskReqSetPriority_Map[ index ]
0717   ];
0718 }
0719 
0720 static void RtemsTaskReqSetPriority_SetPreConditionStates(
0721   RtemsTaskReqSetPriority_Context *ctx
0722 )
0723 {
0724   ctx->Map.pcs[ 0 ] = ctx->Map.pci[ 0 ];
0725 
0726   if ( ctx->Map.entry.Pre_State_NA ) {
0727     ctx->Map.pcs[ 1 ] = RtemsTaskReqSetPriority_Pre_State_NA;
0728   } else {
0729     ctx->Map.pcs[ 1 ] = ctx->Map.pci[ 1 ];
0730   }
0731 
0732   ctx->Map.pcs[ 2 ] = ctx->Map.pci[ 2 ];
0733 
0734   if ( ctx->Map.entry.Pre_TaskPriority_NA ) {
0735     ctx->Map.pcs[ 3 ] = RtemsTaskReqSetPriority_Pre_TaskPriority_NA;
0736   } else {
0737     ctx->Map.pcs[ 3 ] = ctx->Map.pci[ 3 ];
0738   }
0739 
0740   ctx->Map.pcs[ 4 ] = ctx->Map.pci[ 4 ];
0741 }
0742 
0743 static void RtemsTaskReqSetPriority_TestVariant(
0744   RtemsTaskReqSetPriority_Context *ctx
0745 )
0746 {
0747   RtemsTaskReqSetPriority_Pre_Id_Prepare( ctx, ctx->Map.pcs[ 0 ] );
0748   RtemsTaskReqSetPriority_Pre_State_Prepare( ctx, ctx->Map.pcs[ 1 ] );
0749   RtemsTaskReqSetPriority_Pre_NewPriority_Prepare( ctx, ctx->Map.pcs[ 2 ] );
0750   RtemsTaskReqSetPriority_Pre_TaskPriority_Prepare( ctx, ctx->Map.pcs[ 3 ] );
0751   RtemsTaskReqSetPriority_Pre_OldPriority_Prepare( ctx, ctx->Map.pcs[ 4 ] );
0752   RtemsTaskReqSetPriority_Action( ctx );
0753   RtemsTaskReqSetPriority_Post_Status_Check( ctx, ctx->Map.entry.Post_Status );
0754   RtemsTaskReqSetPriority_Post_Priority_Check(
0755     ctx,
0756     ctx->Map.entry.Post_Priority
0757   );
0758   RtemsTaskReqSetPriority_Post_OldPriorityObj_Check(
0759     ctx,
0760     ctx->Map.entry.Post_OldPriorityObj
0761   );
0762 }
0763 
0764 /**
0765  * @fn void T_case_body_RtemsTaskReqSetPriority( void )
0766  */
0767 T_TEST_CASE_FIXTURE(
0768   RtemsTaskReqSetPriority,
0769   &RtemsTaskReqSetPriority_Fixture
0770 )
0771 {
0772   RtemsTaskReqSetPriority_Context *ctx;
0773 
0774   ctx = T_fixture_context();
0775   ctx->Map.in_action_loop = true;
0776   ctx->Map.index = 0;
0777 
0778   for (
0779     ctx->Map.pci[ 0 ] = RtemsTaskReqSetPriority_Pre_Id_Invalid;
0780     ctx->Map.pci[ 0 ] < RtemsTaskReqSetPriority_Pre_Id_NA;
0781     ++ctx->Map.pci[ 0 ]
0782   ) {
0783     for (
0784       ctx->Map.pci[ 1 ] = RtemsTaskReqSetPriority_Pre_State_Dormant;
0785       ctx->Map.pci[ 1 ] < RtemsTaskReqSetPriority_Pre_State_NA;
0786       ++ctx->Map.pci[ 1 ]
0787     ) {
0788       for (
0789         ctx->Map.pci[ 2 ] = RtemsTaskReqSetPriority_Pre_NewPriority_Current;
0790         ctx->Map.pci[ 2 ] < RtemsTaskReqSetPriority_Pre_NewPriority_NA;
0791         ++ctx->Map.pci[ 2 ]
0792       ) {
0793         for (
0794           ctx->Map.pci[ 3 ] = RtemsTaskReqSetPriority_Pre_TaskPriority_High;
0795           ctx->Map.pci[ 3 ] < RtemsTaskReqSetPriority_Pre_TaskPriority_NA;
0796           ++ctx->Map.pci[ 3 ]
0797         ) {
0798           for (
0799             ctx->Map.pci[ 4 ] = RtemsTaskReqSetPriority_Pre_OldPriority_Valid;
0800             ctx->Map.pci[ 4 ] < RtemsTaskReqSetPriority_Pre_OldPriority_NA;
0801             ++ctx->Map.pci[ 4 ]
0802           ) {
0803             ctx->Map.entry = RtemsTaskReqSetPriority_PopEntry( ctx );
0804             RtemsTaskReqSetPriority_SetPreConditionStates( ctx );
0805             RtemsTaskReqSetPriority_Prepare( ctx );
0806             RtemsTaskReqSetPriority_TestVariant( ctx );
0807             RtemsTaskReqSetPriority_Cleanup( ctx );
0808           }
0809         }
0810       }
0811     }
0812   }
0813 }
0814 
0815 /** @} */