tests: devicetree: test great-grandchild bindings
At some point, "child-binding:" apparently only worked up to 2 levels deep. That's not the case anymore, but add a regression test to make sure that doesn't break. 3 levels deep ought to be enough for anyone. Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This commit is contained in:
parent
71686dde4b
commit
930c5807d5
3 changed files with 47 additions and 1 deletions
27
dts/bindings/test/vnd,great-grandchild-bindings.yaml
Normal file
27
dts/bindings/test/vnd,great-grandchild-bindings.yaml
Normal file
|
@ -0,0 +1,27 @@
|
|||
# Copyright (c) 2020 Nordic Semiconductor ASA
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
description: |
|
||||
Test binding for 3 levels of "child-binding".
|
||||
|
||||
Previous versions of Zephyr only allowed up to two levels of
|
||||
"child-binding:" in a YAML file. This file is used to test that the
|
||||
restriction no longer holds.
|
||||
|
||||
compatible: "vnd,great-grandchild-bindings"
|
||||
|
||||
include: [base.yaml]
|
||||
|
||||
child-binding:
|
||||
description: child node, no properties
|
||||
|
||||
child-binding:
|
||||
description: grandchild node, no properties
|
||||
|
||||
child-binding:
|
||||
description: great-grandchild node, ggc-prop property
|
||||
|
||||
properties:
|
||||
ggc-prop:
|
||||
type: int
|
||||
required: true
|
|
@ -332,5 +332,17 @@
|
|||
val = <2>;
|
||||
};
|
||||
};
|
||||
|
||||
test-great-grandchildren {
|
||||
compatible = "vnd,great-grandchild-bindings";
|
||||
|
||||
child {
|
||||
grandchild {
|
||||
test_ggc: great-grandchild {
|
||||
ggc-prop = <42>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1442,6 +1442,12 @@ static void test_child_nodes_list(void)
|
|||
#undef TEST_FUNC
|
||||
}
|
||||
|
||||
static void test_great_grandchild(void)
|
||||
{
|
||||
zassert_equal(DT_PROP(DT_NODELABEL(test_ggc), ggc_prop),
|
||||
42, "great-grandchild bindings returned wrong value");
|
||||
}
|
||||
|
||||
void test_main(void)
|
||||
{
|
||||
ztest_test_suite(devicetree_api,
|
||||
|
@ -1471,7 +1477,8 @@ void test_main(void)
|
|||
ztest_unit_test(test_enums),
|
||||
ztest_unit_test(test_clocks),
|
||||
ztest_unit_test(test_parent),
|
||||
ztest_unit_test(test_child_nodes_list)
|
||||
ztest_unit_test(test_child_nodes_list),
|
||||
ztest_unit_test(test_great_grandchild)
|
||||
);
|
||||
ztest_run_test_suite(devicetree_api);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue