Changeset 6135d0a in rtems-central


Ignore:
Timestamp:
Aug 4, 2020, 4:58:34 AM (7 weeks ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
a25f7ea
Parents:
a581446
git-author:
Sebastian Huber <sebastian.huber@…> (08/04/20 04:58:34)
git-committer:
Sebastian Huber <sebastian.huber@…> (08/07/20 09:12:24)
Message:

validation: Move action code to separate function

Location:
rtemsspec
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • rtemsspec/tests/test_validation.py

    ra581446 r6135d0a  
    727727};
    728728
     729static void ClassicTaskIdentification_Action(
     730  ClassicTaskIdentification_Context *ctx
     731)
     732{
     733  ctx->status = rtems_task_ident( ctx->name, ctx->node, ctx->id );
     734}
     735
    729736/**
    730737 * @fn void T_case_body_ClassicTaskIdentification( void )
     
    787794        ClassicTaskIdentification_Pre_Node_Prepare( ctx, ctx->pcs[ 1 ] );
    788795        ClassicTaskIdentification_Pre_Id_Prepare( ctx, ctx->pcs[ 2 ] );
    789         ctx->status = rtems_task_ident( ctx->name, ctx->node, ctx->id );
     796        ClassicTaskIdentification_Action( ctx );
    790797        ClassicTaskIdentification_Post_Status_Check(
    791798          ctx,
     
    14101417};
    14111418
     1419static void Action2_Action( Action2_Context *ctx )
     1420{
     1421  /* Action */
     1422}
     1423
    14121424static T_fixture_node Action2_Node;
    14131425
     
    14531465      Action2_Pre_A_Prepare( ctx, ctx->pcs[ 0 ] );
    14541466      Action2_Pre_B_Prepare( ctx, ctx->pcs[ 1 ] );
    1455       /* Action */
     1467      Action2_Action( ctx );
    14561468      Action2_Post_A_Check(
    14571469        ctx,
  • rtemsspec/validation.py

    ra581446 r6135d0a  
    473473
    474474    def _add_action(self, content: CContent) -> None:
     475        with content.function("static void", f"{self.ident}_Action",
     476                              [f"{self.context} *ctx"]):
     477            content.append(self.substitute_code(self["test-action"]))
     478
     479    def _add_loop_body(self, content: CContent) -> None:
    475480        with content.condition(f"{self.ident}_TransitionInfo[ index ].Skip"):
    476481            content.append(["++index;", "continue;"])
     
    478483        for index, enum in enumerate(self._pre_index_to_enum):
    479484            content.append(f"{enum[0]}_Prepare( ctx, ctx->pcs[ {index} ] );")
    480         content.append(self.substitute_code(self["test-action"]))
     485        content.append(f"{self.ident}_Action( ctx );")
    481486        transition_map = f"{self.ident}_TransitionMap"
    482487        for index, enum in enumerate(self._post_index_to_enum):
     
    506511                self._add_for_loops(content, index + 1)
    507512        else:
    508             self._add_action(content)
     513            self._add_loop_body(content)
    509514
    510515    def _add_test_case(self, content: CContent, header: Dict[str,
     
    638643        ])
    639644        self._add_transition_map(content)
     645        self._add_action(content)
    640646        self._add_test_case(content, header)
    641647        content.add("/** @} */")
Note: See TracChangeset for help on using the changeset viewer.