summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2023-05-05 14:41:19 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2023-05-08 21:58:56 +0200
commit6d70c4df1678c8761884d89198781aa74f6c1974 (patch)
tree04c295afcc6d578ddbd2900fd476ab2e946546bc
parentspec: Move Timecounter Handler group (diff)
downloadrtems-central-6d70c4df1678c8761884d89198781aa74f6c1974.tar.bz2
items: Add "initialize-links" option to ItemCache
-rw-r--r--rtemsspec/items.py5
-rw-r--r--rtemsspec/tests/test_items_itemcache.py3
2 files changed, 6 insertions, 2 deletions
diff --git a/rtemsspec/items.py b/rtemsspec/items.py
index 1adbcdc7..1bc29dec 100644
--- a/rtemsspec/items.py
+++ b/rtemsspec/items.py
@@ -755,8 +755,9 @@ class ItemCache:
self._load_items(config)
if post_process_load:
post_process_load(self._items)
- self._init_parents()
- self._init_children()
+ if config.get("initialize-links", True):
+ self._init_parents()
+ self._init_children()
spec_root = config["spec-type-root-uid"]
if spec_root:
self._root_type = _gather_spec_refinements(self[spec_root])
diff --git a/rtemsspec/tests/test_items_itemcache.py b/rtemsspec/tests/test_items_itemcache.py
index ff75db12..6cb35e3e 100644
--- a/rtemsspec/tests/test_items_itemcache.py
+++ b/rtemsspec/tests/test_items_itemcache.py
@@ -96,6 +96,9 @@ v: x""")
def test_load_link_error(tmpdir):
config = create_item_cache_config_and_copy_spec(tmpdir,
"spec-item-cache-2")
+ config["initialize-links"] = False
+ ItemCache(config)
+ config["initialize-links"] = True
with pytest.raises(
KeyError,
match=r"^\"item '/a' links to non-existing item 'nix'\"$"):