[rtems-central commit] validation: Fix transition variants skip

Sebastian Huber sebh at rtems.org
Wed Sep 15 06:02:36 UTC 2021


Module:    rtems-central
Branch:    master
Commit:    5631f885156a28d63a09222dbfedb40c9f47d422
Changeset: http://git.rtems.org/rtems-central/commit/?id=5631f885156a28d63a09222dbfedb40c9f47d422

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Mon Sep 13 14:28:31 2021 +0200

validation: Fix transition variants skip

---

 rtemsspec/tests/test_validation.py | 8 ++------
 rtemsspec/validation.py            | 8 ++++----
 2 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/rtemsspec/tests/test_validation.py b/rtemsspec/tests/test_validation.py
index b47aaca..a5b252b 100644
--- a/rtemsspec/tests/test_validation.py
+++ b/rtemsspec/tests/test_validation.py
@@ -2246,16 +2246,12 @@ static void Action2_Skip( Action2_Context *ctx, size_t index )
   increment = 1;
 
   switch ( index + 1 ) {
-    case 0:
-      increment *= Action2_Pre_A_NA;
-      ctx->Map.pcs[ 0 ] = Action2_Pre_A_NA - 1;
-      /* Fall through */
     case 1:
-      increment *= Action2_Pre_B_NA;
+      increment *= Action2_Pre_B_NA - ctx->Map.pcs[ 1 ];
       ctx->Map.pcs[ 1 ] = Action2_Pre_B_NA - 1;
       /* Fall through */
     case 2:
-      increment *= Action2_Pre_C_NA;
+      increment *= Action2_Pre_C_NA - ctx->Map.pcs[ 2 ];
       ctx->Map.pcs[ 2 ] = Action2_Pre_C_NA - 1;
       break;
   }
diff --git a/rtemsspec/validation.py b/rtemsspec/validation.py
index 741a060..a5ac604 100644
--- a/rtemsspec/validation.py
+++ b/rtemsspec/validation.py
@@ -603,13 +603,13 @@ class _ActionRequirementTestItem(_TestItem):
             ])
             fall_through = "/* Fall through */"
             with content.indent():
-                for index, enum in enumerate(self._pre_co_idx_to_enum):
+                for index, enum in enumerate(self._pre_co_idx_to_enum[1:], 1):
                     content.add(f"case {index}:")
                     with content.indent():
+                        pcs = f"ctx->Map.pcs[ {index} ]"
                         content.append([
-                            f"increment *= {enum[-1]};",
-                            f"ctx->Map.pcs[ {index} ] = {enum[-1]} - 1;",
-                            fall_through
+                            f"increment *= {enum[-1]} - {pcs};",
+                            f"{pcs} = {enum[-1]} - 1;", fall_through
                         ])
                 content.lines[-1] = content.lines[-1].replace(
                     fall_through, "break;")



More information about the vc mailing list