tests: lib: devicetree: api: test DT_INST_PARENT
Check that DT_INST_PARENT behavior is correct. Re-uses existing overlay definitions (child of TEST_SPI_BUS_0) to test the behavior. Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
parent
14860d8a97
commit
0c0ad3d332
1 changed files with 9 additions and 0 deletions
|
@ -1639,11 +1639,20 @@ static void test_clocks(void)
|
|||
25000000, "");
|
||||
}
|
||||
|
||||
#undef DT_DRV_COMPAT
|
||||
#define DT_DRV_COMPAT vnd_spi_device
|
||||
static void test_parent(void)
|
||||
{
|
||||
/* The label of a child node's parent is the label of the parent. */
|
||||
zassert_true(!strcmp(DT_LABEL(DT_PARENT(TEST_SPI_DEV_0)),
|
||||
DT_LABEL(TEST_SPI_BUS_0)), "");
|
||||
|
||||
/*
|
||||
* The parent's label for the first instance of vnd,spi-device,
|
||||
* child of TEST_SPI, is the same as TEST_SPI.
|
||||
*/
|
||||
zassert_true(!strcmp(DT_LABEL(DT_INST_PARENT(0)),
|
||||
DT_LABEL(TEST_SPI)), "");
|
||||
/*
|
||||
* We should be able to use DT_PARENT() even with nodes, like /test,
|
||||
* that have no matching compatible.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue