[rtems-central commit] validation: Reorder generated code
Sebastian Huber
sebh at rtems.org
Wed Mar 17 17:37:29 UTC 2021
Module: rtems-central
Branch: master
Commit: c24f22326fa714b047185f0054a3a7fd0fac0d47
Changeset: http://git.rtems.org/rtems-central/commit/?id=c24f22326fa714b047185f0054a3a7fd0fac0d47
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Sun Mar 14 20:32:12 2021 +0100
validation: Reorder generated code
---
rtemsspec/tests/test_validation.py | 92 +++++++++++++++++++-------------------
rtemsspec/validation.py | 10 ++---
2 files changed, 51 insertions(+), 51 deletions(-)
diff --git a/rtemsspec/tests/test_validation.py b/rtemsspec/tests/test_validation.py
index a3e32b7..bfa7207 100644
--- a/rtemsspec/tests/test_validation.py
+++ b/rtemsspec/tests/test_validation.py
@@ -603,27 +603,11 @@ static void Directive_Teardown_Wrap( void *arg )
Directive_Teardown( ctx );
}
-static size_t Directive_Scope( void *arg, char *buf, size_t n )
+static void Directive_Action( Directive_Context *ctx )
{
- Directive_Context *ctx;
-
- ctx = arg;
-
- if ( ctx->in_action_loop ) {
- return T_get_scope( Directive_PreDesc, buf, n, ctx->pcs );
- }
-
- return 0;
+ ctx->status = rtems_task_ident( ctx->name, ctx->node, ctx->id );
}
-static T_fixture Directive_Fixture = {
- .setup = Directive_Setup_Wrap,
- .stop = NULL,
- .teardown = Directive_Teardown_Wrap,
- .scope = Directive_Scope,
- .initial_context = &Directive_Instance
-};
-
typedef struct {
uint16_t Skip : 1;
uint16_t Pre_Name_NA : 1;
@@ -686,11 +670,27 @@ Directive_Map[] = {
#undef E
-static void Directive_Action( Directive_Context *ctx )
+static size_t Directive_Scope( void *arg, char *buf, size_t n )
{
- ctx->status = rtems_task_ident( ctx->name, ctx->node, ctx->id );
+ Directive_Context *ctx;
+
+ ctx = arg;
+
+ if ( ctx->in_action_loop ) {
+ return T_get_scope( Directive_PreDesc, buf, n, ctx->pcs );
+ }
+
+ return 0;
}
+static T_fixture Directive_Fixture = {
+ .setup = Directive_Setup_Wrap,
+ .stop = NULL,
+ .teardown = Directive_Teardown_Wrap,
+ .scope = Directive_Scope,
+ .initial_context = &Directive_Instance
+};
+
/**
* @fn void T_case_body_Directive( void )
*/
@@ -2014,26 +2014,20 @@ static void Action2_Teardown_Wrap( void *arg )
Action2_Teardown( ctx );
}
-static size_t Action2_Scope( void *arg, char *buf, size_t n )
+static void Action2_Prepare( Action2_Context *ctx )
{
- Action2_Context *ctx;
-
- ctx = arg;
-
- if ( ctx->in_action_loop ) {
- return T_get_scope( Action2_PreDesc, buf, n, ctx->pcs );
- }
+ /* Prepare */
+}
- return 0;
+static void Action2_Action( Action2_Context *ctx )
+{
+ /* Action */
}
-static T_fixture Action2_Fixture = {
- .setup = Action2_Setup_Wrap,
- .stop = NULL,
- .teardown = Action2_Teardown_Wrap,
- .scope = Action2_Scope,
- .initial_context = &Action2_Instance
-};
+static void Action2_Cleanup( Action2_Context *ctx )
+{
+ /* Cleanup */
+}
typedef struct {
uint8_t Skip : 1;
@@ -2058,21 +2052,27 @@ Action2_Map[] = {
#undef E
-static void Action2_Prepare( Action2_Context *ctx )
+static size_t Action2_Scope( void *arg, char *buf, size_t n )
{
- /* Prepare */
-}
+ Action2_Context *ctx;
-static void Action2_Action( Action2_Context *ctx )
-{
- /* Action */
-}
+ ctx = arg;
-static void Action2_Cleanup( Action2_Context *ctx )
-{
- /* Cleanup */
+ if ( ctx->in_action_loop ) {
+ return T_get_scope( Action2_PreDesc, buf, n, ctx->pcs );
+ }
+
+ return 0;
}
+static T_fixture Action2_Fixture = {
+ .setup = Action2_Setup_Wrap,
+ .stop = NULL,
+ .teardown = Action2_Teardown_Wrap,
+ .scope = Action2_Scope,
+ .initial_context = &Action2_Instance
+};
+
static T_fixture_node Action2_Node;
void Action2_Run( int *a, int b, int *c )
diff --git a/rtemsspec/validation.py b/rtemsspec/validation.py
index 082da45..ee1d34d 100644
--- a/rtemsspec/validation.py
+++ b/rtemsspec/validation.py
@@ -914,6 +914,11 @@ class _ActionRequirementTestItem(_TestItem):
"test-teardown",
"Teardown",
optional_code=optional_code)
+ self.add_function(content, "test-prepare", "Prepare")
+ self.add_function(content, "test-action", "Action")
+ self.add_function(content, "test-cleanup", "Cleanup")
+ transition_map = TransitionMap(self.item)
+ transition_map.add_map(content, self.ident)
self._add_fixture_scope(content)
content.add([
f"static T_fixture {self.ident}_Fixture = {{",
@@ -921,11 +926,6 @@ class _ActionRequirementTestItem(_TestItem):
f" .teardown = {teardown},", f" .scope = {self.ident}_Scope,",
f" .initial_context = {instance}", "};"
])
- transition_map = TransitionMap(self.item)
- transition_map.add_map(content, self.ident)
- self.add_function(content, "test-prepare", "Prepare")
- self.add_function(content, "test-action", "Action")
- self.add_function(content, "test-cleanup", "Cleanup")
self._add_test_case(content, transition_map, header)
content.add("/** @} */")
More information about the vc
mailing list