diff options
author | Simon Glass <sjg@chromium.org> | 2017-05-19 05:09:43 +0300 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2017-06-01 16:03:14 +0300 |
commit | 298afb52cb583cbf7af52037454aef3a648f9824 (patch) | |
tree | 40bfa032d971c75c0dd5340881242c069d321513 /test/dm | |
parent | 8b92e1cd597608ca1e2aa2756c76a3dff786062c (diff) | |
download | u-boot-298afb52cb583cbf7af52037454aef3a648f9824.tar.xz |
dm: test: Separate out the bus DT offset test
We cannot access the device tree via an offset when running in livetree
mode. Separate out that part of the bus' children tests and mark it as
for the flat tree only.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test/dm')
-rw-r--r-- | test/dm/bus.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/test/dm/bus.c b/test/dm/bus.c index 6a2773565e..8ba75d4b7d 100644 --- a/test/dm/bus.c +++ b/test/dm/bus.c @@ -160,8 +160,21 @@ static int dm_test_bus_children_funcs(struct unit_test_state *uts) node = fdt_path_offset(blob, "/d-test"); ut_asserteq(-ENODEV, device_find_child_by_of_offset(bus, node, &dev)); + return 0; +} +DM_TEST(dm_test_bus_children_funcs, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); + +static int dm_test_bus_children_of_offset(struct unit_test_state *uts) +{ + const void *blob = gd->fdt_blob; + struct udevice *bus, *dev; + int node; + + ut_assertok(uclass_get_device(UCLASS_TEST_BUS, 0, &bus)); + /* Find a valid child */ node = fdt_path_offset(blob, "/some-bus/c-test@1"); + ut_assert(node > 0); ut_assertok(device_find_child_by_of_offset(bus, node, &dev)); ut_assert(!(dev->flags & DM_FLAG_ACTIVATED)); ut_assertok(device_get_child_by_of_offset(bus, node, &dev)); @@ -169,7 +182,8 @@ static int dm_test_bus_children_funcs(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_bus_children_funcs, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_bus_children_of_offset, + DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT | DM_TESTF_FLAT_TREE); /* Test that we can iterate through children */ static int dm_test_bus_children_iterators(struct unit_test_state *uts) |