summaryrefslogtreecommitdiffstats
path: root/rtemsspec
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2021-03-17 15:56:27 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2021-03-17 18:35:11 +0100
commit8012787bc72a3fc1208a9b07b5a7ca318dd3e24d (patch)
tree9bcabca30a0f28ddd13063f88993f49f2f73045c /rtemsspec
parentcontent: Add support for CPU port options (diff)
downloadrtems-central-8012787bc72a3fc1208a9b07b5a7ca318dd3e24d.tar.bz2
specview: Add option to show action req tables
Diffstat (limited to 'rtemsspec')
-rw-r--r--rtemsspec/tests/test_validation.py9
-rw-r--r--rtemsspec/validation.py7
2 files changed, 14 insertions, 2 deletions
diff --git a/rtemsspec/tests/test_validation.py b/rtemsspec/tests/test_validation.py
index 5a0f165b..032b531f 100644
--- a/rtemsspec/tests/test_validation.py
+++ b/rtemsspec/tests/test_validation.py
@@ -27,7 +27,7 @@
import os
import pytest
-from rtemsspec.validation import generate
+from rtemsspec.validation import generate, TransitionMap
from rtemsspec.items import EmptyItemCache, Item, ItemCache
from rtemsspec.tests.util import create_item_cache_config_and_copy_spec
@@ -40,7 +40,12 @@ def test_validation(tmpdir):
item_cache_config = create_item_cache_config_and_copy_spec(
tmpdir, "spec-validation", with_spec_types=True)
- generate(validation_config, ItemCache(item_cache_config))
+ item_cache = ItemCache(item_cache_config)
+
+ transition_map = TransitionMap(item_cache["/action2"])
+ assert transition_map.post_co_idx_st_idx_to_st_name(0, 0) == "A0"
+
+ generate(validation_config, item_cache)
with open(os.path.join(base_directory, "ts.c"), "r") as src:
content = """/* SPDX-License-Identifier: BSD-2-Clause */
diff --git a/rtemsspec/validation.py b/rtemsspec/validation.py
index 05bb2bcd..a36aa19b 100644
--- a/rtemsspec/validation.py
+++ b/rtemsspec/validation.py
@@ -679,6 +679,13 @@ class TransitionMap:
"""
return self._pre_co_idx_st_idx_to_st_name[co_idx][st_idx]
+ def post_co_idx_st_idx_to_st_name(self, co_idx: int, st_idx: int) -> str:
+ """
+ Maps the post-condition name and state index to the associated state
+ name.
+ """
+ return self._post_co_idx_st_idx_to_st_name[co_idx][st_idx]
+
def pre_co_idx_st_name_to_st_idx(self, co_idx: int, st_name: str) -> int:
"""
Maps the pre-condition index and state name to the associated state