Skip to content

Commit

Permalink
edtlib: test filters set by including bindings
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
dottspina authored and carlescufi committed Apr 22, 2024
1 parent b3b5ad8 commit 33bb3b6
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SPDX-License-Identifier: BSD-3-Clause

include: base.yaml
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
17 changes: 17 additions & 0 deletions scripts/dts/python-devicetree/tests/test_edtlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down

0 comments on commit 33bb3b6

Please sign in to comment.