Commit 33bb3b60 authored by Christophe Dufaza's avatar Christophe Dufaza Committed by Carles Cufi
Browse files

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: default avatarChristophe Dufaza <chris@openmarl.org>
parent b3b5ad81
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: BSD-3-Clause

include: base.yaml
+10 −0
Original line number Diff line number Diff line
# 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
+10 −0
Original line number Diff line number Diff line
# 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 −0
Original line number Diff line number Diff line
@@ -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():