edtlib: test filters set by including bindings

Make sure filters set by property-allowlist and property-blocklist
in an including binding are recursively applied to included bindings.

Signed-off-by: Christophe Dufaza <chris@openmarl.org>
This commit is contained in:
Christophe Dufaza 2023-12-05 08:48:10 +01:00 committed by Carles Cufí
parent b3b5ad8156
commit 33bb3b60d9
4 changed files with 40 additions and 0 deletions

View File

@ -0,0 +1,3 @@
# SPDX-License-Identifier: BSD-3-Clause
include: base.yaml

View File

@ -0,0 +1,10 @@
# SPDX-License-Identifier: BSD-3-Clause
description: Test property-allowlist filters set by including bindings
compatible: "top-allowlist"
include:
- name: inc-base.yaml
property-allowlist:
- x

View File

@ -0,0 +1,10 @@
# SPDX-License-Identifier: BSD-3-Clause
description: Test property-blocklist filters set by including bindings.
compatible: "top-blocklist"
include:
- name: inc-base.yaml
property-blocklist:
- x

View File

@ -378,6 +378,23 @@ def test_include_paths():
assert 'base.yaml' == os.path.basename(top.prop2specs["y"].path)
assert 'top.yaml' == os.path.basename(top.prop2specs["p"].path)
def test_include_filters_included_bindings():
'''Test filters set by including bindings.'''
fname2path = {'base.yaml': 'test-bindings-include/base.yaml',
'inc-base.yaml': 'test-bindings-include/inc-base.yaml'}
with from_here():
top_allows = edtlib.Binding('test-bindings-include/top-allows.yaml', fname2path)
assert top_allows.prop2specs.get("x")
assert not top_allows.prop2specs.get("y")
with from_here():
top_blocks = edtlib.Binding('test-bindings-include/top-blocks.yaml', fname2path)
assert not top_blocks.prop2specs.get("x")
assert top_blocks.prop2specs.get("y")
def test_bus():
'''Test 'bus:' and 'on-bus:' in bindings'''
with from_here():