summaryrefslogtreecommitdiffstats
path: root/rtemsspec
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2021-02-03 11:19:04 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2021-02-03 13:38:06 +0100
commit5a1eea68d929cb2cacc714369bb4c60a25bdfac0 (patch)
tree22055149c9c09c61b0addf9fcbd8cf56e41d5ed2 /rtemsspec
parentvalidation: Improve test program error message (diff)
downloadrtems-central-5a1eea68d929cb2cacc714369bb4c60a25bdfac0.tar.bz2
validation: Improve no states error message
Diffstat (limited to 'rtemsspec')
-rw-r--r--rtemsspec/tests/test_validation.py13
-rw-r--r--rtemsspec/validation.py4
2 files changed, 16 insertions, 1 deletions
diff --git a/rtemsspec/tests/test_validation.py b/rtemsspec/tests/test_validation.py
index 9abc9da9..d0c74e18 100644
--- a/rtemsspec/tests/test_validation.py
+++ b/rtemsspec/tests/test_validation.py
@@ -2076,3 +2076,16 @@ def test_validation_invalid_actions():
"item of type 'build/test-program'")
with pytest.raises(ValueError, match=match):
generate(validation_config, item_cache)
+ test_program_data = {
+ "SPDX-License-Identifier": spdx,
+ "copyrights": [copyright],
+ "build-type": "test-program",
+ "enabled-by": True,
+ "links": [],
+ "source": ["a.c"],
+ "type": "build",
+ }
+ _add_item(item_cache, "/tp", test_program_data, "build/test-program")
+ match = "pre-condition 'A' of spec:/a has no states"
+ with pytest.raises(ValueError, match=match):
+ generate(validation_config, item_cache)
diff --git a/rtemsspec/validation.py b/rtemsspec/validation.py
index 6515ca23..fda72b80 100644
--- a/rtemsspec/validation.py
+++ b/rtemsspec/validation.py
@@ -531,7 +531,9 @@ class _ActionRequirementTestItem(_TestItem):
transition_count = 1
for condition in self["pre-conditions"]:
state_count = len(condition["states"])
- assert state_count > 0
+ if state_count == 0:
+ raise ValueError(f"pre-condition '{condition['name']}' of "
+ f"{self.item.spec} has no states")
transition_count *= state_count
transition_map = [list() for _ in range(transition_count)
] # type: _TransitionMap