Lines Matching +full:specifier +full:- +full:space

2 # SPDX-License-Identifier: BSD-3-Clause
23 # test.dts is the main test file. test-bindings/ and test-bindings-2/ has
46 with from_here(): edtlib.EDT("test.dts", ["test-bindings"])
48 enums_hpath = hpath('test-bindings/enums.yaml')
50 … marked as deprecated in 'properties:' in {hpath('test-bindings/deprecated.yaml')} for node /test-
51 "unit address and first address in 'reg' (0x1) don't match for /reg-zero-size-cells/node",
52 "unit address and first address in 'reg' (0x5) don't match for /reg-ranges/parent/node",
53 …"unit address and first address in 'reg' (0x30000000200000001) don't match for /reg-nested-ranges/…
54 …f"compatible 'enums' in binding '{enums_hpath}' has non-tokenizable enum for property 'string-enum…
55 …f"compatible 'enums' in binding '{enums_hpath}' has enum for property 'tokenizable-lower-enum' tha…
63 edt = edtlib.EDT("test.dts", ["test-bindings"])
65 node = edt.get_node("/interrupt-parent-test/node")
66 controller = edt.get_node('/interrupt-parent-test/controller')
72 node = edt.get_node("/interrupts-extended-test/node")
73 controller_0 = edt.get_node('/interrupts-extended-test/controller-0')
74 controller_1 = edt.get_node('/interrupts-extended-test/controller-1')
75 controller_2 = edt.get_node('/interrupts-extended-test/controller-2')
82 node = edt.get_node("/interrupt-map-test/node@0")
83 controller_0 = edt.get_node('/interrupt-map-test/controller-0')
84 controller_1 = edt.get_node('/interrupt-map-test/controller-1')
85 controller_2 = edt.get_node('/interrupt-map-test/controller-2')
93 node = edt.get_node("/interrupt-map-test/node@1")
100 node = edt.get_node("/interrupt-map-bitops-test/node@70000000E")
102 …edtlib.ControllerAndData(node=node, controller=edt.get_node('/interrupt-map-bitops-test/controller…
108 edt = edtlib.EDT("test.dts", ["test-bindings"])
110 node = edt.get_node("/reg-ranges/parent")
117 node = edt.get_node("/reg-nested-ranges/grandparent")
122 node = edt.get_node("/reg-nested-ranges/grandparent/parent")
127 assert edt.get_node("/ranges-zero-cells/node").ranges == []
129 node = edt.get_node("/ranges-zero-parent-cells/node")
136 node = edt.get_node("/ranges-one-address-cells/node")
143 node = edt.get_node("/ranges-one-address-two-size-cells/node")
150 node = edt.get_node("/ranges-two-address-cells/node@1")
157 node = edt.get_node("/ranges-two-address-two-size-cells/node@1")
164 node = edt.get_node("/ranges-three-address-cells/node@1")
171 node = edt.get_node("/ranges-three-address-two-size-cells/node@1")
181 edt = edtlib.EDT("test.dts", ["test-bindings"])
193 verify_regs(edt.get_node("/reg-zero-address-cells/node"),
197 verify_regs(edt.get_node("/reg-zero-size-cells/node"),
201 verify_regs(edt.get_node("/reg-ranges/parent/node"),
209 verify_regs(edt.get_node("/reg-nested-ranges/grandparent/parent/node"),
213 '''Test 'pinctrl-<index>'.'''
215 edt = edtlib.EDT("test.dts", ["test-bindings"])
218 state_1 = edt.get_node('/pinctrl/pincontroller/state-1')
219 state_2 = edt.get_node('/pinctrl/pincontroller/state-2')
229 edt = edtlib.EDT("test.dts", ["test-bindings"])
233 assert str(edt.get_node("/parent/child-1").parent) == \
236 assert str(edt.get_node("/parent/child-2/grandchild").parent) == \
237 "<Node /parent/child-2 in 'test.dts', no binding>"
240 …"{'child-1': <Node /parent/child-1 in 'test.dts', no binding>, 'child-2': <Node /parent/child-2 in…
242 assert edt.get_node("/parent/child-1").children == {}
247 edt = edtlib.EDT("test.dts", ["test-bindings"])
251 "/parent/child-1",
252 "/parent/child-2")]
261 edt = edtlib.EDT("test.dts", ["test-bindings"])
263 binding_include = edt.get_node("/binding-include")
272 verify_props(edt.get_node("/binding-include/child"),
278 '''Test property-allowlist and property-blocklist in an include.'''
280 fname2path = {'include.yaml': 'test-bindings-include/include.yaml',
281 'include-2.yaml': 'test-bindings-include/include-2.yaml'}
285 edtlib.Binding("test-bindings-include/allow-and-blocklist.yaml", fname2path)
286 assert ("should not specify both 'property-allowlist:' and 'property-blocklist:'"
291 edtlib.Binding("test-bindings-include/allow-and-blocklist-child.yaml", fname2path)
292 assert ("should not specify both 'property-allowlist:' and 'property-blocklist:'"
297 edtlib.Binding("test-bindings-include/allow-not-list.yaml", fname2path)
299 assert value_str.startswith("'property-allowlist' value")
304 edtlib.Binding("test-bindings-include/block-not-list.yaml", fname2path)
306 assert value_str.startswith("'property-blocklist' value")
311 binding = edtlib.Binding("test-bindings-include/include-invalid-keys.yaml", fname2path)
314 "'include:' in test-bindings-include/include-invalid-keys.yaml should not have these "
316 assert 'bad-key-1' in value_str
317 assert 'bad-key-2' in value_str
321 binding = edtlib.Binding("test-bindings-include/include-invalid-type.yaml", fname2path)
324 "'include:' in test-bindings-include/include-invalid-type.yaml "
329 binding = edtlib.Binding("test-bindings-include/include-no-name.yaml", fname2path)
333 "in test-bindings-include/include-no-name.yaml should have a 'name' key")
336 binding = edtlib.Binding("test-bindings-include/allowlist.yaml", fname2path)
339 binding = edtlib.Binding("test-bindings-include/empty-allowlist.yaml", fname2path)
342 binding = edtlib.Binding("test-bindings-include/blocklist.yaml", fname2path)
345 binding = edtlib.Binding("test-bindings-include/empty-blocklist.yaml", fname2path)
348 binding = edtlib.Binding("test-bindings-include/intermixed.yaml", fname2path)
351 binding = edtlib.Binding("test-bindings-include/include-no-list.yaml", fname2path)
354 binding = edtlib.Binding("test-bindings-include/filter-child-bindings.yaml", fname2path)
358 assert set(child.prop2specs.keys()) == {'child-prop-2'}
359 assert set(grandchild.prop2specs.keys()) == {'grandchild-prop-1'}
361 binding = edtlib.Binding("test-bindings-include/allow-and-blocklist-multilevel.yaml",
365 assert set(child.prop2specs.keys()) == {'child-prop-1', 'child-prop-2',
368 def test_include_filters_inherited_bindings() -> None:
371 Use-case "B includes I includes X":
372 - X is a base binding file, specifying common properties
373 - I is an intermediary binding file, which includes X without modification
375 - B includes I, filtering the properties it chooses to inherit
382 # Base binding file, specifies a few properties up to the grandchild-binding level.
383 "simple.yaml": "test-bindings-include/simple.yaml",
385 "simple_inherit.yaml": "test-bindings-include/simple_inherit.yaml",
390 "test-bindings-include/simple_filter_allowlist.yaml",
396 assert {"prop-1"} == set(binding.prop2specs.keys())
401 "test-bindings-include/simple_filter_blocklist.yaml",
407 assert {"prop-1"} == set(binding.prop2specs.keys())
409 def test_include_filters_inherited_child_bindings() -> None:
411 (child-binding level).
416 "simple.yaml": "test-bindings-include/simple.yaml",
417 "simple_inherit.yaml": "test-bindings-include/simple_inherit.yaml",
421 "test-bindings-include/simple_filter_allowlist.yaml",
429 assert {"child-prop-1"} == set(child_binding.prop2specs.keys())
433 "test-bindings-include/simple_filter_blocklist.yaml",
441 assert {"child-prop-1"} == set(child_binding.prop2specs.keys())
443 def test_include_filters_inherited_grandchild_bindings() -> None:
445 (grandchild-binding level).
450 "simple.yaml": "test-bindings-include/simple.yaml",
451 "simple_inherit.yaml": "test-bindings-include/simple_inherit.yaml",
455 "test-bindings-include/simple_filter_allowlist.yaml",
465 assert {"grandchild-prop-1"} == set(grandchild_binding.prop2specs.keys())
469 "test-bindings-include/simple_filter_blocklist.yaml",
479 assert {"grandchild-prop-1"} == set(grandchild_binding.prop2specs.keys())
482 '''Test 'bus:' and 'on-bus:' in bindings'''
484 edt = edtlib.EDT("test.dts", ["test-bindings"])
486 assert isinstance(edt.get_node("/buses/foo-bus").buses, list)
487 assert "foo" in edt.get_node("/buses/foo-bus").buses
489 # foo-bus does not itself appear on a bus
490 assert isinstance(edt.get_node("/buses/foo-bus").on_buses, list)
491 assert not edt.get_node("/buses/foo-bus").on_buses
492 assert edt.get_node("/buses/foo-bus").bus_node is None
494 # foo-bus/node1 is not a bus node...
495 assert isinstance(edt.get_node("/buses/foo-bus/node1").buses, list)
496 assert not edt.get_node("/buses/foo-bus/node1").buses
498 assert isinstance(edt.get_node("/buses/foo-bus/node1").on_buses, list)
499 assert "foo" in edt.get_node("/buses/foo-bus/node1").on_buses
500 assert edt.get_node("/buses/foo-bus/node1").bus_node.path == \
501 "/buses/foo-bus"
503 # foo-bus/node2 is not a bus node...
504 assert isinstance(edt.get_node("/buses/foo-bus/node2").buses, list)
505 assert not edt.get_node("/buses/foo-bus/node2").buses
507 assert isinstance(edt.get_node("/buses/foo-bus/node2").on_buses, list)
508 assert "foo" in edt.get_node("/buses/foo-bus/node2").on_buses
510 # no-bus-node is not a bus node...
511 assert isinstance(edt.get_node("/buses/no-bus-node").buses, list)
512 assert not edt.get_node("/buses/no-bus-node").buses
514 assert isinstance(edt.get_node("/buses/no-bus-node").on_buses, list)
515 assert not edt.get_node("/buses/no-bus-node").on_buses
519 assert str(edt.get_node("/buses/foo-bus/node1").binding_path) == \
520 hpath("test-bindings/device-on-foo-bus.yaml")
521 assert str(edt.get_node("/buses/foo-bus/node2").binding_path) == \
522 hpath("test-bindings/device-on-any-bus.yaml")
523 assert str(edt.get_node("/buses/bar-bus/node").binding_path) == \
524 hpath("test-bindings/device-on-bar-bus.yaml")
525 assert str(edt.get_node("/buses/no-bus-node").binding_path) == \
526 hpath("test-bindings/device-on-any-bus.yaml")
528 # foo-bus/node/nested also appears on the foo-bus bus
529 assert isinstance(edt.get_node("/buses/foo-bus/node1/nested").on_buses, list)
530 assert "foo" in edt.get_node("/buses/foo-bus/node1/nested").on_buses
531 assert str(edt.get_node("/buses/foo-bus/node1/nested").binding_path) == \
532 hpath("test-bindings/device-on-foo-bus.yaml")
535 '''Test 'child-binding:' in bindings'''
537 edt = edtlib.EDT("test.dts", ["test-bindings"])
538 child1 = edt.get_node("/child-binding/child-1")
539 child2 = edt.get_node("/child-binding/child-2")
540 grandchild = edt.get_node("/child-binding/child-1/grandchild")
542 assert str(child1.binding_path) == hpath("test-bindings/child-binding.yaml")
544 verify_props(child1, ['child-prop'], ['int'], [1])
546 assert str(child2.binding_path) == hpath("test-bindings/child-binding.yaml")
548 verify_props(child2, ['child-prop'], ['int'], [3])
550 assert str(grandchild.binding_path) == hpath("test-bindings/child-binding.yaml")
552 verify_props(grandchild, ['grandchild-prop'], ['int'], [2])
555 binding_file = Path("test-bindings/child-binding.yaml").resolve()
560 assert top.compatible == 'top-binding'
564 binding_file = Path("test-bindings/child-binding-with-compat.yaml").resolve()
569 assert top.compatible == 'top-binding-with-compat'
570 assert child.compatible == 'child-compat'
575 edt = edtlib.EDT("test.dts", ["test-bindings"])
578 ctrl_1, ctrl_2 = [edt.get_node(path) for path in ['/ctrl-1', '/ctrl-2']]
582 'existent-boolean', 'nonexistent-boolean',
583 'array', 'uint8-array',
584 'string', 'string-array',
585 'phandle-ref', 'phandle-refs',
589 'array', 'uint8-array',
590 'string', 'string-array',
601 'phandle-array-foos',
605 verify_phandle_array_prop(edt.get_node("/props-2"),
606 "phandle-array-foos",
607 [(edt.get_node('/ctrl-0-1'), {}),
609 (edt.get_node('/ctrl-0-2'), {})])
612 'foo-gpios',
613 [(ctrl_1, {'gpio-one': 1})])
616 '''Test <prefix>-map via gpio-map (the most common case).'''
618 edt = edtlib.EDT("test.dts", ["test-bindings"])
620 source = edt.get_node("/gpio-map/source")
621 destination = edt.get_node('/gpio-map/destination')
623 'foo-gpios',
627 assert source.props["foo-gpios"].val[0].basename == f"gpio"
632 edt = edtlib.EDT("test.dts", ["test-bindings"])
636 'array', 'uint8-array',
637 'string', 'string-array',
638 'default-not-used'],
640 'array', 'uint8-array',
641 'string', 'string-array',
652 edt = edtlib.EDT("test.dts", ["test-bindings"])
654 int_enum = props['int-enum']
655 string_enum = props['string-enum']
656 tokenizable_enum = props['tokenizable-enum']
657 tokenizable_lower_enum = props['tokenizable-lower-enum']
658 array_enum = props['array-enum']
659 string_array_enum = props['string-array-enum']
660 no_enum = props['no-enum']
700 '''Test inferred bindings for special zephyr-specific nodes.'''
703 edt = edtlib.EDT("test.dts", ["test-bindings"], warnings)
708 edt = edtlib.EDT("test.dts", ["test-bindings"], warnings,
710 ctrl_1 = edt.get_node('/ctrl-1')
711 ctrl_2 = edt.get_node('/ctrl-2')
717 ['boolean', 'uint8-array', 'int',
718 'array', 'string', 'string-array'],
731 'phandle-array-foos',
732 [(edt.get_node('/ctrl-2'), {'one': 1, 'two': 2})])
737 edt = edtlib.EDT("test-multidir.dts", ["test-bindings", "test-bindings-2"])
739 assert str(edt.get_node("/in-dir-1").binding_path) == \
740 hpath("test-bindings/multidir.yaml")
742 assert str(edt.get_node("/in-dir-2").binding_path) == \
743 hpath("test-bindings-2/multidir.yaml")
748 edt = edtlib.EDT("test-multidir.dts", ["test-bindings", "test-bindings-2"])
751 assert edt.get_node("/in-dir-1").dep_ordinal == 1
752 assert edt.get_node("/") in edt.get_node("/in-dir-1").depends_on
753 assert edt.get_node("/in-dir-1") in edt.get_node("/").required_by
758 edt = edtlib.EDT("test.dts", ["test-bindings"])
760 dep_node = edt.get_node("/child-binding-dep")
762 assert dep_node in edt.get_node("/child-binding").depends_on
763 assert dep_node in edt.get_node("/child-binding/child-1/grandchild").depends_on
764 assert dep_node in edt.get_node("/child-binding/child-2").depends_on
765 assert edt.get_node("/child-binding") in dep_node.required_by
766 assert edt.get_node("/child-binding/child-1/grandchild") in dep_node.required_by
767 assert edt.get_node("/child-binding/child-2") in dep_node.required_by
775 /dts-v1/;
778 #address-cells = <1>;
779 #size-cells = <2>;
787 …hich is not evenly divisible by 12 (= 4*(<#address-cells> (= 1) + <#size-cells> (= 2))). Note that…
790 /dts-v1/;
795 interrupt-parent = < &{/controller} >;
798 interrupt-controller;
799 #interrupt-cells = <2>;
804 …has length 4, which is not evenly divisible by 8 (= 4*<#interrupt-cells>). Note that #*-cells prop…
807 /dts-v1/;
810 #address-cells = <1>;
812 sub-1 {
813 #address-cells = <2>;
814 #size-cells = <3>;
817 sub-2 {
824-1 in '{dts_file}'> has length 8, which is not evenly divisible by 24 (= 4*(<#address-cells> (= 2)…
833 /dts-v1/;
842 …o' compatible 'no, whitespace' must match this regular expression: '^[a-zA-Z][a-zA-Z0-9,+\-._]+$'")
849 edtlib.Binding("test-wrong-bindings/wrong-specifier-space-type.yaml", None)
850 …assert ("'specifier-space' in 'properties: wrong-type-for-specifier-space' has type 'phandle', exp…
854 edtlib.Binding("test-wrong-bindings/wrong-phandle-array-name.yaml", None)
856 assert value_str.startswith("'wrong-phandle-array-name' in 'properties:'")
857 assert value_str.endswith("but no 'specifier-space' was provided.")
866 edt = edtlib.EDT("test-multidir.dts",
867 ["test-bindings", "test-bindings-2"],
871 infer_binding_for_paths=['/test-node'],
872 vendor_prefixes={'test-vnd': 'A test vendor'},
909 assert edt_copy.dts_path == "test-multidir.dts"
910 assert edt_copy.bindings_dirs == ["test-bindings", "test-bindings-2"]
915 assert edt_copy._infer_binding_for_paths == set(["/test-node"])
917 assert edt_copy._vendor_prefixes == {"test-vnd": "A test vendor"}
941 with open(dts_file, "w", encoding="utf-8") as f:
963 # Verifies 'node.props[name]' is a phandle-array, and has the
968 assert prop.type == 'phandle-array'