summaryrefslogtreecommitdiff
path: root/test/dm/core.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2018-10-10 13:35:17 -0400
committerTom Rini <trini@konsulko.com>2018-10-10 13:35:17 -0400
commit3d5ced9e22d32112a20f9dc0f5fb1f22ef088079 (patch)
tree2c1e1f34c4dad05dfd08bd3687e6aee634c58500 /test/dm/core.c
parent98068b3be51a77d8b931a2f5097b5c22c57bcea5 (diff)
parent41b781ddf1869f5349e05ace888979f3673fe8c6 (diff)
Merge tag 'dm-9oct18' of git://git.denx.de/u-boot-dm
Test improvements to tidy up output and drop duplicate tests Sandbox SPL/TPL support Various dm-related improvements
Diffstat (limited to 'test/dm/core.c')
-rw-r--r--test/dm/core.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/dm/core.c b/test/dm/core.c
index c15a8406c09..260f6494a2e 100644
--- a/test/dm/core.c
+++ b/test/dm/core.c
@@ -870,3 +870,34 @@ static int dm_test_uclass_names(struct unit_test_state *uts)
return 0;
}
DM_TEST(dm_test_uclass_names, DM_TESTF_SCAN_PDATA);
+
+static int dm_test_inactive_child(struct unit_test_state *uts)
+{
+ struct dm_test_state *dms = uts->priv;
+ struct udevice *parent, *dev1, *dev2;
+
+ /* Skip the behaviour in test_post_probe() */
+ dms->skip_post_probe = 1;
+
+ ut_assertok(uclass_first_device_err(UCLASS_TEST, &parent));
+
+ /*
+ * Create a child but do not activate it. Calling the function again
+ * should return the same child.
+ */
+ ut_asserteq(-ENODEV, device_find_first_inactive_child(parent,
+ UCLASS_TEST, &dev1));
+ ut_assertok(device_bind_ofnode(parent, DM_GET_DRIVER(test_drv),
+ "test_child", 0, ofnode_null(), &dev1));
+
+ ut_assertok(device_find_first_inactive_child(parent, UCLASS_TEST,
+ &dev2));
+ ut_asserteq_ptr(dev1, dev2);
+
+ ut_assertok(device_probe(dev1));
+ ut_asserteq(-ENODEV, device_find_first_inactive_child(parent,
+ UCLASS_TEST, &dev2));
+
+ return 0;
+}
+DM_TEST(dm_test_inactive_child, DM_TESTF_SCAN_PDATA);