-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
scripts: edt: Add support for include property filtering
Add the ability to filter which properties get imported when we do an include. We add a new YAML form for this: include: - name: other.yaml property-blocklist: - prop-to-block or include: - name: other.yaml property-allowlist: - prop-to-allow These lists can intermix simple file names with maps, like: include: - foo.yaml - name: bar.yaml property-allowlist: - prop-to-allow And you can filter from child bindings like this: include: - name: bar.yaml child-binding: property-allowlist: - child-prop-to-allow Signed-off-by: Kumar Gala <[email protected]> Signed-off-by: Martí Bolívar <[email protected]>
- Loading branch information
1 parent
64995e2
commit 85e2021
Showing
20 changed files
with
400 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
scripts/dts/python-devicetree/tests/test-bindings-include/README.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This directory contains bindings used to test the 'include:' feature. |
11 changes: 11 additions & 0 deletions
11
scripts/dts/python-devicetree/tests/test-bindings-include/allow-and-blocklist-child.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
|
||
description: | | ||
An include must not give both an allowlist and a blocklist in a | ||
child binding. This binding should cause an error. | ||
compatible: allow-and-blocklist-child | ||
include: | ||
- name: include.yaml | ||
child-binding: | ||
property-blocklist: [x] | ||
property-allowlist: [y] |
10 changes: 10 additions & 0 deletions
10
scripts/dts/python-devicetree/tests/test-bindings-include/allow-and-blocklist.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
|
||
description: | | ||
An include must not give both an allowlist and a blocklist. | ||
This binding should cause an error. | ||
compatible: allow-and-blocklist | ||
include: | ||
- name: include.yaml | ||
property-blocklist: [x] | ||
property-allowlist: [y] |
10 changes: 10 additions & 0 deletions
10
scripts/dts/python-devicetree/tests/test-bindings-include/allow-not-list.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
|
||
description: | | ||
A property-allowlist, if given, must be a list. This binding should | ||
cause an error. | ||
compatible: allow-not-list | ||
include: | ||
- name: include.yaml | ||
property-allowlist: | ||
foo: |
7 changes: 7 additions & 0 deletions
7
scripts/dts/python-devicetree/tests/test-bindings-include/allowlist.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
|
||
description: Valid property-allowlist. | ||
compatible: allowlist | ||
include: | ||
- name: include.yaml | ||
property-allowlist: [x] |
10 changes: 10 additions & 0 deletions
10
scripts/dts/python-devicetree/tests/test-bindings-include/block-not-list.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
|
||
description: | | ||
A property-blocklist, if given, must be a list. This binding should | ||
cause an error. | ||
compatible: block-not-list | ||
include: | ||
- name: include.yaml | ||
property-blocklist: | ||
foo: |
7 changes: 7 additions & 0 deletions
7
scripts/dts/python-devicetree/tests/test-bindings-include/blocklist.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
|
||
description: Valid property-blocklist. | ||
compatible: blocklist | ||
include: | ||
- name: include.yaml | ||
property-blocklist: [x] |
7 changes: 7 additions & 0 deletions
7
scripts/dts/python-devicetree/tests/test-bindings-include/empty-allowlist.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
|
||
description: An empty property-allowlist is valid. | ||
compatible: empty-allowlist | ||
include: | ||
- name: include.yaml | ||
property-allowlist: [] |
7 changes: 7 additions & 0 deletions
7
scripts/dts/python-devicetree/tests/test-bindings-include/empty-blocklist.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
|
||
description: An empty property-blocklist is valid. | ||
compatible: empty-blocklist | ||
include: | ||
- name: include.yaml | ||
property-blocklist: [] |
11 changes: 11 additions & 0 deletions
11
scripts/dts/python-devicetree/tests/test-bindings-include/filter-child-bindings.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
description: Test binding for filtering 'child-binding' properties | ||
|
||
include: | ||
- name: include.yaml | ||
property-allowlist: [x] | ||
child-binding: | ||
property-blocklist: [child-prop-1] | ||
child-binding: | ||
property-allowlist: [grandchild-prop-1] | ||
|
||
compatible: filter-child-bindings |
7 changes: 7 additions & 0 deletions
7
scripts/dts/python-devicetree/tests/test-bindings-include/include-2.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
|
||
description: Second file for testing "intermixed" includes. | ||
compatible: include-2 | ||
properties: | ||
a: | ||
type: int |
10 changes: 10 additions & 0 deletions
10
scripts/dts/python-devicetree/tests/test-bindings-include/include-invalid-keys.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
|
||
description: | | ||
Invalid include element: invalid keys are present. | ||
compatible: include-invalid-keys | ||
include: | ||
- name: include.yaml | ||
property-allowlist: [x] | ||
bad-key-1: 3 | ||
bad-key-2: 3 |
5 changes: 5 additions & 0 deletions
5
scripts/dts/python-devicetree/tests/test-bindings-include/include-invalid-type.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
description: | | ||
Invalid include: wrong top level type. | ||
compatible: include-invalid-type | ||
include: | ||
a-map-is-not-allowed-here: 3 |
6 changes: 6 additions & 0 deletions
6
scripts/dts/python-devicetree/tests/test-bindings-include/include-no-list.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
|
||
description: A map element with just a name is valid, and has no filters. | ||
compatible: include-no-list | ||
include: | ||
- name: include.yaml |
7 changes: 7 additions & 0 deletions
7
scripts/dts/python-devicetree/tests/test-bindings-include/include-no-name.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
|
||
description: | | ||
Invalid include element: no name key is present. | ||
compatible: include-no-name | ||
include: | ||
- property-allowlist: [x] |
24 changes: 24 additions & 0 deletions
24
scripts/dts/python-devicetree/tests/test-bindings-include/include.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
|
||
description: Test file for including other bindings | ||
compatible: include | ||
properties: | ||
x: | ||
type: int | ||
y: | ||
type: int | ||
z: | ||
type: int | ||
child-binding: | ||
properties: | ||
child-prop-1: | ||
type: int | ||
child-prop-2: | ||
type: int | ||
|
||
child-binding: | ||
properties: | ||
grandchild-prop-1: | ||
type: int | ||
grandchild-prop-2: | ||
type: int |
8 changes: 8 additions & 0 deletions
8
scripts/dts/python-devicetree/tests/test-bindings-include/intermixed.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
|
||
description: Including intermixed file names and maps is valid. | ||
compatible: intermixed | ||
include: | ||
- name: include.yaml | ||
property-allowlist: [x] | ||
- include-2.yaml |
Oops, something went wrong.