scripts: testedtlib: add more child-binding tests
The child_binding object should default to having a path and compatible that matches the parent's. Mark it as xfail because the compatible part is failing. Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This commit is contained in:
parent
4ff6061b09
commit
2522eec578
2 changed files with 37 additions and 0 deletions
20
scripts/dts/test-bindings/child-binding-with-compat.yaml
Normal file
20
scripts/dts/test-bindings/child-binding-with-compat.yaml
Normal file
|
@ -0,0 +1,20 @@
|
|||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
description: child-binding with separate compatible than the parent
|
||||
|
||||
compatible: "child-binding-with-compat"
|
||||
|
||||
child-binding:
|
||||
compatible: child-compat
|
||||
description: child node
|
||||
properties:
|
||||
child-prop:
|
||||
type: int
|
||||
required: true
|
||||
|
||||
child-binding:
|
||||
description: grandchild node
|
||||
properties:
|
||||
grandchild-prop:
|
||||
type: int
|
||||
required: true
|
|
@ -137,6 +137,7 @@ def test_bus():
|
|||
assert str(edt.get_node("/buses/foo-bus/node/nested").binding_path) == \
|
||||
hpath("test-bindings/device-on-foo-bus.yaml")
|
||||
|
||||
@pytest.mark.xfail
|
||||
def test_child_binding():
|
||||
'''Test 'child-binding:' in bindings'''
|
||||
edt = edtlib.EDT("test.dts", ["test-bindings"])
|
||||
|
@ -156,6 +157,22 @@ def test_child_binding():
|
|||
assert str(grandchild.description) == "grandchild node"
|
||||
assert str(grandchild.props) == "OrderedDict([('grandchild-prop', <Property, name: grandchild-prop, type: int, value: 2>)])"
|
||||
|
||||
binding_file = Path("test-bindings/child-binding.yaml").resolve()
|
||||
top = edtlib.Binding(binding_file, {})
|
||||
child = top.child_binding
|
||||
assert Path(top.path) == binding_file
|
||||
assert Path(child.path) == binding_file
|
||||
assert top.compatible == 'child-binding'
|
||||
assert child.compatible == 'child-binding'
|
||||
|
||||
binding_file = Path("test-bindings/child-binding-with-compat.yaml").resolve()
|
||||
top = edtlib.Binding(binding_file, {})
|
||||
child = top.child_binding
|
||||
assert Path(top.path) == binding_file
|
||||
assert Path(child.path) == binding_file
|
||||
assert top.compatible == 'child-binding-with-compat'
|
||||
assert child.compatible == 'child-compat'
|
||||
|
||||
def test_props():
|
||||
'''Test Node.props (derived from DT and 'properties:' in the binding)'''
|
||||
edt = edtlib.EDT("test.dts", ["test-bindings"])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue