zephyr/scripts/dts/python-devicetree/tests/test-bindings-init/thing.yaml
Christophe Dufaza ee5c520326 edtlib: tests: refine coverage of Binding objects initialization
Add a series of unit tests which try to cover somewhat systematically
the possible inputs and what we finally get at the exit
of the Binding constructor.

Running the assumption that any (valid) YAML binding file is
something we can make a Binding instance with:
- check which properties are defined at which level (binding,
  child-binding, grandchild-binding, etc) and their specifications
  once the binding is initialized
- check how including bindings are permitted to specialize
  the specifications of inherited properties
- check the rules applied when overwriting a binding's description
  or compatible string (at the binding, child-binding, etc, levels)

Some tests covering known issues are disabled by default:
- this permits to document these issues
- while not causing CI errors (when running the python-devicetree
  unit tests)
- enabling these tests without causing errors should allow us
  to consider the related issues are fixed

Signed-off-by: Christophe Dufaza <chris@openmarl.org>
2025-01-08 19:17:51 +01:00

73 lines
1.8 KiB
YAML

# SPDX-License-Identifier: BSD-3-Clause
#
# Right (included last) YAML file for testing diamond inheritance.
#
# Amends base.yaml.
#
# Binding level:
# - prop-1 (amended)
# - prop-enum (amended)
# - prop-thing (new property)
#
# Child-binding level:
# - child-prop-1 (amended)
# - child-prop-enum (amended)
# - child-prop-thing (new property)
#
# Grandchild-binding level:
# - grandchild-prop-1 (amended)
# - grandchild-prop-enum (amended)
# - grandchild-prop-thing (new property)
description: Description of 'thing.yaml'.
include:
- name: base.yaml
property-allowlist: [prop-1, prop-enum]
child-binding:
property-allowlist: [child-prop-1, child-prop-enum]
child-binding:
property-allowlist: [grandchild-prop-1, grandchild-prop-enum]
properties:
prop-1:
default: 1
# Diamond inheritance in diamond.yaml: should overwrite
# the amended description from base_amend.yaml.
description: Overwritten in thing.yaml.
prop-enum:
# This is the definition inherited from base.yaml.
#
# Diamond inheritance in diamond.yaml: should be ORed
# with the definition inherited via base_amend.yaml.
required: false
prop-thing:
description: Thing property.
type: int
child-binding:
description: Child-binding description (thing).
properties:
child-prop-1:
description: Overwritten in thing.yaml (child).
default: 2
child-prop-enum:
required: false
child-prop-thing:
description: Thing child-binding property.
type: int
child-binding:
description: Grandchild-binding description (thing).
properties:
grandchild-prop-1:
description: Overwritten in thing.yaml (grandchild).
default: 3
grandchild-prop-enum:
required: false
grandchild-prop-thing:
description: Thing grandchild-binding property.
type: int