Browse Source

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>
pull/83707/head
Christophe Dufaza 9 months ago committed by Benjamin Cabé
parent
commit
ee5c520326
  1. 104
      scripts/dts/python-devicetree/tests/test-bindings-init/base.yaml
  2. 96
      scripts/dts/python-devicetree/tests/test-bindings-init/base_amend.yaml
  3. 5
      scripts/dts/python-devicetree/tests/test-bindings-init/base_inherit.yaml
  4. 103
      scripts/dts/python-devicetree/tests/test-bindings-init/base_multi.yaml
  5. 18
      scripts/dts/python-devicetree/tests/test-bindings-init/compat_desc.yaml
  6. 16
      scripts/dts/python-devicetree/tests/test-bindings-init/compat_desc_base.yaml
  7. 14
      scripts/dts/python-devicetree/tests/test-bindings-init/compat_desc_multi.yaml
  8. 93
      scripts/dts/python-devicetree/tests/test-bindings-init/diamond.yaml
  9. 12
      scripts/dts/python-devicetree/tests/test-bindings-init/filter_allows_notblocked.yaml
  10. 12
      scripts/dts/python-devicetree/tests/test-bindings-init/filter_among_allowed.yaml
  11. 12
      scripts/dts/python-devicetree/tests/test-bindings-init/filter_among_notblocked.yaml
  12. 11
      scripts/dts/python-devicetree/tests/test-bindings-init/invalid_child_propconst.yaml
  13. 11
      scripts/dts/python-devicetree/tests/test-bindings-init/invalid_child_propdefault.yaml
  14. 13
      scripts/dts/python-devicetree/tests/test-bindings-init/invalid_child_propenum.yaml
  15. 11
      scripts/dts/python-devicetree/tests/test-bindings-init/invalid_child_propreq.yaml
  16. 11
      scripts/dts/python-devicetree/tests/test-bindings-init/invalid_child_proptype.yaml
  17. 12
      scripts/dts/python-devicetree/tests/test-bindings-init/invalid_grandchild_propconst.yaml
  18. 12
      scripts/dts/python-devicetree/tests/test-bindings-init/invalid_grandchild_propdefault.yaml
  19. 14
      scripts/dts/python-devicetree/tests/test-bindings-init/invalid_grandchild_propenum.yaml
  20. 12
      scripts/dts/python-devicetree/tests/test-bindings-init/invalid_grandchild_propreq.yaml
  21. 12
      scripts/dts/python-devicetree/tests/test-bindings-init/invalid_grandchild_proptype.yaml
  22. 15
      scripts/dts/python-devicetree/tests/test-bindings-init/invalid_propconst.yaml
  23. 15
      scripts/dts/python-devicetree/tests/test-bindings-init/invalid_propdefault.yaml
  24. 17
      scripts/dts/python-devicetree/tests/test-bindings-init/invalid_propenum.yaml
  25. 15
      scripts/dts/python-devicetree/tests/test-bindings-init/invalid_propreq.yaml
  26. 15
      scripts/dts/python-devicetree/tests/test-bindings-init/invalid_proptype.yaml
  27. 30
      scripts/dts/python-devicetree/tests/test-bindings-init/simple.yaml
  28. 12
      scripts/dts/python-devicetree/tests/test-bindings-init/simple_allowlist.yaml
  29. 12
      scripts/dts/python-devicetree/tests/test-bindings-init/simple_blocklist.yaml
  30. 5
      scripts/dts/python-devicetree/tests/test-bindings-init/simple_inherit.yaml
  31. 72
      scripts/dts/python-devicetree/tests/test-bindings-init/thing.yaml
  32. 20
      scripts/dts/python-devicetree/tests/test-bindings-init/vnd,thing.yaml
  33. 1160
      scripts/dts/python-devicetree/tests/test_edtlib_binding_init.py

104
scripts/dts/python-devicetree/tests/test-bindings-init/base.yaml

@ -0,0 +1,104 @@ @@ -0,0 +1,104 @@
# SPDX-License-Identifier: BSD-3-Clause
#
# Base include file for testing bindings initialization.
#
# Involves base property definitions ("type:", "description:", "const:",
# "required:", "enum:" and "default:") up to the grandchild-binding level.
#
# Binding:
# + prop-1
# + prop-2
# + prop-enum
# + prop-req
# + prop-const
# + prop-default
#
# Child-binding:
# + child-prop-1
# + child-prop-2
# + child-prop-enum
# + child-prop-req
# + child-prop-const
# + child-prop-default
#
# Grandchild-binding:
# + grandchild-prop-1
# + grandchild-prop-2
# + grandchild-prop-enum
# + grandchild-prop-req
# + grandchild-prop-const
# + grandchild-prop-default
description: Base property specifications.
properties:
prop-1:
description: Base property 1.
type: int
prop-2:
type: string
prop-enum:
type: string
required: false
enum:
- FOO
- BAR
prop-const:
type: int
const: 8
prop-req:
type: int
required: true
prop-default:
type: int
default: 1
child-binding:
description: Base child-binding description.
properties:
child-prop-1:
description: Base child-prop 1.
type: int
child-prop-2:
type: string
child-prop-enum:
type: string
required: false
enum:
- CHILD_FOO
- CHILD_BAR
child-prop-const:
type: int
const: 16
child-prop-req:
type: int
required: true
child-prop-default:
type: int
default: 2
child-binding:
description: Base grandchild-binding description.
properties:
grandchild-prop-1:
description: Base grandchild-prop 1.
type: int
grandchild-prop-2:
type: string
grandchild-prop-enum:
type: string
required: false
enum:
- GRANDCHILD_FOO
- GRANDCHILD_BAR
grandchild-prop-const:
type: int
const: 32
grandchild-prop-req:
type: int
required: true
grandchild-prop-default:
type: int
default: 3

96
scripts/dts/python-devicetree/tests/test-bindings-init/base_amend.yaml

@ -0,0 +1,96 @@ @@ -0,0 +1,96 @@
# SPDX-License-Identifier: BSD-3-Clause
#
# Amends base properties specifications:
# - extends property specifications by adding definitions,
# e.g. setting a "default:" value
# - overwrites existing definitions of a property,
# e.g. change its "description:"
# - specify new properties
#
# The same kind of amendments are applied to the same properties
# at each level (binding, child-binding, grandchild-binding).
#
# | Definition | Extended for | Overwritten for |
# |----------------|--------------|-----------------|
# | description: | prop-2 | prop-1 |
# | required: | | prop-enum |
# | enum: | prop-2 | |
# | const: | prop-1 | |
# | default: | prop-2 | |
#
# Non authorized amendments, e.g. changing a "const:" value
# or downgrading a "required: true" definition are tested separately.
description: Amended description.
include: base.yaml
properties:
prop-1:
# The including binding is permitted to overwrite a property description.
description: Overwritten description.
# The including binding is permitted to set a "const:" value.
const: 0xf0
prop-2:
# The including binding is permitted to add a property description.
description: New description.
# The including binding is permitted to limit property values
# to an enumeration.
enum:
- EXT_FOO
- EXT_BAR
# The including binding is permitted to set a default value.
default: EXT_FOO
# The including binding is permitted to promote a property
# to requirement.
prop-enum:
required: true
# The including binding is permitted to define a new property.
prop-new:
type: int
# Same amendments at the child-binding level.
child-binding:
properties:
child-prop-1:
description: Overwritten description (child).
const: 0xf1
child-prop-2:
description: New description (child).
enum:
- CHILD_EXT_FOO
- CHILD_EXT_BAR
default: CHILD_EXT_FOO
child-prop-enum:
required: true
child-prop-new:
type: int
# Same amendments at the grandchild-binding level.
child-binding:
# Plus amended grandchild-binding description.
description: Amended grandchild-binding description.
properties:
grandchild-prop-1:
description: Overwritten description (grandchild).
const: 0xf2
grandchild-prop-2:
description: New description (grandchild).
enum:
- GRANDCHILD_EXT_FOO
- GRANDCHILD_EXT_BAR
default: GRANDCHILD_EXT_FOO
grandchild-prop-enum:
required: true
grandchild-prop-new:
type: int

5
scripts/dts/python-devicetree/tests/test-bindings-init/base_inherit.yaml

@ -0,0 +1,5 @@ @@ -0,0 +1,5 @@
# SPDX-License-Identifier: BSD-3-Clause
#
# Inherit base specifications without modification.
include: base.yaml

103
scripts/dts/python-devicetree/tests/test-bindings-init/base_multi.yaml

@ -0,0 +1,103 @@ @@ -0,0 +1,103 @@
# SPDX-License-Identifier: BSD-3-Clause
#
# Includes base bindings at multiple levels (binding,
# child-binding, grandchild-binding):
#
# include: base.yaml
# child-binding:
# include: base.yaml
# child-binding:
# include: base.yaml
#
# Which properties are specified at which levels is summarized bellow
# for convenience.
#
# Child-binding level:
# From top-level "include:" element.
# - child-prop-1 (amended)
# - child-prop-2
# - child-prop-enum
# From "child-binding: include:" element.
# - prop-1 (amended)
# - prop-2 (amended)
# - prop-enum (amended)
#
# Grandchild-binding level:
# From top-level "include:" element.
# - grandchild-prop-1 (amended)
# - grandchild-prop-2
# - grandchild-prop-enum
# From "child-binding: include:" element.
# - child-prop-1 (amended)
# - child-prop-2
# - child-prop-enum
# From "child-binding: child-binding: include:" element.
# - prop-1 (amended)
# - prop-2 (amended)
# - prop-enum (amended)
#
# Grand-grandchild-binding level:
# From "child-binding: include:" element.
# - child-prop-1
# - child-prop-2
# - child-prop-enum
# From "child-binding: child-binding: include:" element.
# - grandchild-prop-1
# - grandchild-prop-2
# - grandchild-prop-enum
description: Description of 'base_multi.yaml'.
include:
- name: base.yaml
child-binding:
property-allowlist: [child-prop-1, child-prop-2, child-prop-enum]
child-binding:
property-allowlist: [grandchild-prop-1, grandchild-prop-2, grandchild-prop-enum]
child-binding:
include:
- name: base.yaml
property-allowlist: [prop-1, prop-2, prop-enum]
child-binding:
property-allowlist: [child-prop-1, child-prop-2, child-prop-enum]
child-binding:
property-allowlist: [grandchild-prop-1, grandchild-prop-2, grandchild-prop-enum]
properties:
# Amend top-level "include:" element.
child-prop-1:
const: 0xf1
# Amend this "child-binding: include:" element.
prop-1:
const: 0xf1
prop-2:
description: New description (child).
prop-enum:
required: true
default: FOO
child-binding:
include:
- name: base.yaml
property-allowlist: [prop-1, prop-2, prop-enum]
child-binding:
property-allowlist: [child-prop-1, child-prop-2, child-prop-enum]
child-binding:
property-allowlist: [grandchild-prop-1, grandchild-prop-2, grandchild-prop-enum]
properties:
# Amend above top-level "include:" element.
grandchild-prop-1:
const: 0xf2
# Amend above "child-binding: include:" element.
child-prop-1:
const: 0xf2
# Amend this "child-binding: child-binding: include:" element.
prop-1:
const: 0xf2
prop-2:
description: New description (grandchild).
prop-enum:
required: true
default: FOO

18
scripts/dts/python-devicetree/tests/test-bindings-init/compat_desc.yaml

@ -0,0 +1,18 @@ @@ -0,0 +1,18 @@
# SPDX-License-Identifier: BSD-3-Clause
#
# Test inheritance rules applied to compatible strings
# and bindings descriptions.
description: Binding description.
compatible: vnd,compat-desc
include: compat_desc_base.yaml
child-binding:
description: Child-binding description.
compatible: vnd,child-compat-desc
child-binding:
description: Grandchild-binding description.
compatible: vnd,grandchild-compat-desc

16
scripts/dts/python-devicetree/tests/test-bindings-init/compat_desc_base.yaml

@ -0,0 +1,16 @@ @@ -0,0 +1,16 @@
# SPDX-License-Identifier: BSD-3-Clause
#
# Base file for testing inheritance rules applied to
# compatible strings and bindings descriptions.
description: Binding description (base).
compatible: vnd,compat-desc-base
child-binding:
description: Child-binding description (base).
compatible: vnd,child-compat-desc-base
child-binding:
description: Grandchild-binding description (base).
compatible: vnd,grandchild-compat-desc-base

14
scripts/dts/python-devicetree/tests/test-bindings-init/compat_desc_multi.yaml

@ -0,0 +1,14 @@ @@ -0,0 +1,14 @@
# SPDX-License-Identifier: BSD-3-Clause
#
# Test consequences of inclusion order on inherited
# compatible strings and descriptions.
description: Binding description (multi).
compatible: vnd,compat-desc-multi
# Descriptions at the child-binding level and bellow
# will depend on inclusion order: the first wins.
include:
- compat_desc_base.yaml
- compat_desc.yaml

93
scripts/dts/python-devicetree/tests/test-bindings-init/diamond.yaml

@ -0,0 +1,93 @@ @@ -0,0 +1,93 @@
# SPDX-License-Identifier: BSD-3-Clause
#
# Binding file for testing diamond inheritance (top-bottom).
#
# diamond.yaml
# / \
# / \
# base_amend.yaml thing.yaml
# \ /
# \ /
# base.yaml
#
# Which properties are specified at which levels is summarized bellow
# for convenience.
#
# * Binding level.
# Diamond's left:
# - prop-1 (amended in base_amend.yaml)
# - prop-enum (amended in base_amend.yaml)
# - prop-default (inherited from base.yaml)
# Diamond's right:
# - prop-1 (last amended in thing.yaml)
# - prop-enum (amended in thing.yaml)
# - prop-thing (inherited from thing.yaml)
# Diamond's top:
# - prop-enum (last amended here)
# - prop-diamond
#
# * Child-binding level:
# Diamond's left:
# - child-prop-1 (amended in base_amend.yaml)
# - child-prop-enum (amended in base_amend.yaml)
# - child-prop-default (inherited from base.yaml)
# Diamond's right:
# - child-prop-1 (last amended in thing.yaml)
# - child-prop-enum (amended in thing.yaml)
# - child-prop-thing (inherited from thing.yaml)
# Diamond's top:
# - child-prop-enum (last amended here)
# - child-prop-diamond
#
# * Grandchild-binding level:
# Diamond's left:
# - grandchild-prop-1 (amended in base_amend.yaml)
# - grandchild-prop-enum (amended in base_amend.yaml)
# - grandchild-prop-default (inherited from base.yaml)
# Diamond's right:
# - grandchild-prop-1 (last amended in thing.yaml)
# - grandchild-prop-enum (amended in thing.yaml)
# - grandchild-prop-thing (inherited from thing.yaml)
# Diamond's top:
# - grandchild-prop-enum (last amended here)
# - grandchild-prop-diamond
description: Diamond's top.
compatible: diamond
include:
# Diamond's left.
- name: base_amend.yaml
property-allowlist: [prop-1, prop-enum, prop-default]
child-binding:
property-allowlist: [child-prop-1, child-prop-enum, child-prop-default]
child-binding:
property-allowlist: [grandchild-prop-1, grandchild-prop-enum, grandchild-prop-default]
# Diamond's right.
- name: thing.yaml
properties:
prop-diamond:
type: int
prop-enum:
description: Overwritten in diamond.yaml.
default: FOO
child-binding:
description: Diamond's child-binding.
properties:
child-prop-diamond:
type: int
child-prop-enum:
description: Overwritten in diamond.yaml (child).
default: CHILD_FOO
child-binding:
properties:
grandchild-prop-diamond:
type: int
grandchild-prop-enum:
description: Overwritten in diamond.yaml (grandchild).
default: GRANDCHILD_FOO

12
scripts/dts/python-devicetree/tests/test-bindings-init/filter_allows_notblocked.yaml

@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
# SPDX-License-Identifier: BSD-3-Clause
#
# This binding file allows a property which is not blocked
# in simple_blocklist.yaml: we should end up with this property.
include:
- name: simple_blocklist.yaml
property-allowlist: [prop-2]
child-binding:
property-allowlist: [child-prop-2]
child-binding:
property-allowlist: [grandchild-prop-2]

12
scripts/dts/python-devicetree/tests/test-bindings-init/filter_among_allowed.yaml

@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
# SPDX-License-Identifier: BSD-3-Clause
#
# This binding file allows only properties that are not allowed
# in simple_allowlist.yaml: we should end up with no property at all.
include:
- name: simple_allowlist.yaml
property-allowlist: [prop-3]
child-binding:
property-allowlist: [child-prop-3]
child-binding:
property-allowlist: [grandchild-prop-3]

12
scripts/dts/python-devicetree/tests/test-bindings-init/filter_among_notblocked.yaml

@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
# SPDX-License-Identifier: BSD-3-Clause
#
# This binding file blocks all properties not blocked
# in simple_filter.yaml: we should end up with no property at all.
include:
- name: simple_blocklist.yaml
property-blocklist: [prop-2, prop-3]
child-binding:
property-blocklist: [child-prop-2, child-prop-3]
child-binding:
property-blocklist: [grandchild-prop-2, grandchild-prop-3]

11
scripts/dts/python-devicetree/tests/test-bindings-init/invalid_child_propconst.yaml

@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
# SPDX-License-Identifier: BSD-3-Clause
#
# This binding should not try to override the "const:" value
# in a property specification inherited from an included file.
include: base.yaml
child-binding:
properties:
child-prop-const:
const: 999

11
scripts/dts/python-devicetree/tests/test-bindings-init/invalid_child_propdefault.yaml

@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
# SPDX-License-Identifier: BSD-3-Clause
#
# This binding should not try to override the "default:" value
# in a property specification inherited from an included file.
include: base.yaml
child-binding:
properties:
child-prop-default:
default: 999

13
scripts/dts/python-devicetree/tests/test-bindings-init/invalid_child_propenum.yaml

@ -0,0 +1,13 @@ @@ -0,0 +1,13 @@
# SPDX-License-Identifier: BSD-3-Clause
#
# This binding should not try to change the "enum:" values
# in a property specification inherited from an included file.
include: base.yaml
child-binding:
properties:
child-prop-enum:
enum:
- OTHER_FOO
- OTHER_BAR

11
scripts/dts/python-devicetree/tests/test-bindings-init/invalid_child_propreq.yaml

@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
# SPDX-License-Identifier: BSD-3-Clause
#
# This binding should not try to override "required: true"
# in a property specification inherited from an included file.
include: base.yaml
child-binding:
properties:
child-prop-req:
required: false

11
scripts/dts/python-devicetree/tests/test-bindings-init/invalid_child_proptype.yaml

@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
# SPDX-License-Identifier: BSD-3-Clause
#
# This binding should not try to override the "type:"
# of an inherited property.
include: base.yaml
child-binding:
properties:
child-prop-1:
type: string

12
scripts/dts/python-devicetree/tests/test-bindings-init/invalid_grandchild_propconst.yaml

@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
# SPDX-License-Identifier: BSD-3-Clause
#
# This binding should not try to override the "const:" value
# in a property specification inherited from an included file.
include: base.yaml
child-binding:
child-binding:
properties:
grandchild-prop-const:
const: 999

12
scripts/dts/python-devicetree/tests/test-bindings-init/invalid_grandchild_propdefault.yaml

@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
# SPDX-License-Identifier: BSD-3-Clause
#
# This binding should not try to override the "default:" value
# in a property specification inherited from an included file.
include: base.yaml
child-binding:
child-binding:
properties:
grandchild-prop-default:
default: 999

14
scripts/dts/python-devicetree/tests/test-bindings-init/invalid_grandchild_propenum.yaml

@ -0,0 +1,14 @@ @@ -0,0 +1,14 @@
# SPDX-License-Identifier: BSD-3-Clause
#
# This binding should not try to change the "enum:" values
# in a property specification inherited from an included file.
include: base.yaml
child-binding:
child-binding:
properties:
grandchild-prop-enum:
enum:
- OTHER_FOO
- OTHER_BAR

12
scripts/dts/python-devicetree/tests/test-bindings-init/invalid_grandchild_propreq.yaml

@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
# SPDX-License-Identifier: BSD-3-Clause
#
# This binding should not try to override "required: true"
# in a property specification inherited from an included file.
include: base.yaml
child-binding:
child-binding:
properties:
grandchild-prop-req:
required: false

12
scripts/dts/python-devicetree/tests/test-bindings-init/invalid_grandchild_proptype.yaml

@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
# SPDX-License-Identifier: BSD-3-Clause
#
# This binding should not try to override the "type:"
# of an inherited property.
include: base.yaml
child-binding:
child-binding:
properties:
grandchild-prop-1:
type: string

15
scripts/dts/python-devicetree/tests/test-bindings-init/invalid_propconst.yaml

@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@
# SPDX-License-Identifier: BSD-3-Clause
#
# This binding should not try to override the "const:" value
# in a property specification inherited from an included file.
#
# Bindings, child-bindings and grandchild-bindings have
# to be tested separately, see also:
# - invalid_child_propconst.yaml
# - invalid_grandchild_propconst.yaml
include: base.yaml
properties:
prop-const:
const: 999

15
scripts/dts/python-devicetree/tests/test-bindings-init/invalid_propdefault.yaml

@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@
# SPDX-License-Identifier: BSD-3-Clause
#
# This binding should not try to override the "default:" value
# in a property specification inherited from an included file.
#
# Bindings, child-bindings and grandchild-bindings have
# to be tested separately, see also:
# - invalid_child_propdefault.yaml
# - invalid_grandchild_propdefault.yaml
include: base.yaml
properties:
prop-default:
default: 999

17
scripts/dts/python-devicetree/tests/test-bindings-init/invalid_propenum.yaml

@ -0,0 +1,17 @@ @@ -0,0 +1,17 @@
# SPDX-License-Identifier: BSD-3-Clause
#
# This binding should not try to change the "enum:" values
# in a property specification inherited from an included file.
#
# Bindings, child-bindings and grandchild-bindings have
# to be tested separately, see also:
# - invalid_child_propenum.yaml
# - invalid_grandchild_propenum.yaml
include: base.yaml
properties:
prop-enum:
enum:
- OTHER_FOO
- OTHER_BAR

15
scripts/dts/python-devicetree/tests/test-bindings-init/invalid_propreq.yaml

@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@
# SPDX-License-Identifier: BSD-3-Clause
#
# This binding should not try to override "required: true"
# in a property specification inherited from an included file.
#
# Bindings, child-bindings and grandchild-bindings have
# to be tested separately, see also:
# - invalid_child_propreq.yaml
# - invalid_grandchild_propreq.yaml
include: base.yaml
properties:
prop-req:
required: false

15
scripts/dts/python-devicetree/tests/test-bindings-init/invalid_proptype.yaml

@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@
# SPDX-License-Identifier: BSD-3-Clause
#
# This binding should not try to override the "type:"
# of an inherited property.
#
# Bindings, child-bindings and grandchild-bindings have
# to be tested separately, see also:
# - invalid_child_protype.yaml
# - invalid_grandchild_proptype.yaml
include: base.yaml
properties:
prop-1:
type: string

30
scripts/dts/python-devicetree/tests/test-bindings-init/simple.yaml

@ -0,0 +1,30 @@ @@ -0,0 +1,30 @@
# SPDX-License-Identifier: BSD-3-Clause
#
# Base properties for testing property filters propagation
# up to the grandchild-binding level.
properties:
prop-1:
type: int
prop-2:
type: int
prop-3:
type: int
child-binding:
properties:
child-prop-1:
type: int
child-prop-2:
type: int
child-prop-3:
type: int
child-binding:
properties:
grandchild-prop-1:
type: int
grandchild-prop-2:
type: int
grandchild-prop-3:
type: int

12
scripts/dts/python-devicetree/tests/test-bindings-init/simple_allowlist.yaml

@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
# SPDX-License-Identifier: BSD-3-Clause
#
# Filter inherited property specifications
# up to the grandchild-binding level.
include:
- name: simple_inherit.yaml
property-allowlist: [prop-1, prop-2]
child-binding:
property-allowlist: [child-prop-1, child-prop-2]
child-binding:
property-allowlist: [grandchild-prop-1, grandchild-prop-2]

12
scripts/dts/python-devicetree/tests/test-bindings-init/simple_blocklist.yaml

@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
# SPDX-License-Identifier: BSD-3-Clause
#
# Filter inherited property specifications
# up to the grandchild-binding level.
include:
- name: simple_inherit.yaml
property-blocklist: [prop-1]
child-binding:
property-blocklist: [child-prop-1]
child-binding:
property-blocklist: [grandchild-prop-1]

5
scripts/dts/python-devicetree/tests/test-bindings-init/simple_inherit.yaml

@ -0,0 +1,5 @@ @@ -0,0 +1,5 @@
# SPDX-License-Identifier: BSD-3-Clause
#
# Inherits property specifications without modification.
include: simple.yaml

72
scripts/dts/python-devicetree/tests/test-bindings-init/thing.yaml

@ -0,0 +1,72 @@ @@ -0,0 +1,72 @@
# 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

20
scripts/dts/python-devicetree/tests/test-bindings-init/vnd,thing.yaml

@ -0,0 +1,20 @@ @@ -0,0 +1,20 @@
# SPDX-License-Identifier: BSD-3-Clause
#
# Top level binding file (device binding) for testing
# descriptions and compatible strings.
description: The Thing device.
compatible: "vnd,thing"
include:
- name: base_amend.yaml
- name: thing.yaml
child-binding:
compatible: "vnd,thing-child"
description: The Thing's child-binding.
child-binding:
compatible: "vnd,thing-grandchild"
description: The Thing's grandchild-binding.

1160
scripts/dts/python-devicetree/tests/test_edtlib_binding_init.py

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save