]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
dm: test: Check all devices have a sequence numbers
authorSimon Glass <sjg@chromium.org>
Thu, 17 Dec 2020 04:20:10 +0000 (21:20 -0700)
committerSimon Glass <sjg@chromium.org>
Sat, 19 Dec 2020 03:32:21 +0000 (20:32 -0700)
Add a test that the new sequence numbers work as expected. Every device
should get one.

Signed-off-by: Simon Glass <sjg@chromium.org>
test/dm/core.c

index 0e0696af9874f6b8d7f817a6599cefd03dd59f87..a7c0f40b775bd06ab0b54355646e08b2a9384416 100644 (file)
@@ -1066,3 +1066,22 @@ static int dm_test_inactive_child(struct unit_test_state *uts)
        return 0;
 }
 DM_TEST(dm_test_inactive_child, UT_TESTF_SCAN_PDATA);
+
+/* Make sure all bound devices have a sequence number */
+static int dm_test_all_have_seq(struct unit_test_state *uts)
+{
+       struct udevice *dev;
+       struct uclass *uc;
+
+       list_for_each_entry(uc, &gd->uclass_root, sibling_node) {
+               list_for_each_entry(dev, &uc->dev_head, uclass_node) {
+                       if (dev->sqq == -1)
+                               printf("Device '%s' has no seq (%d)\n",
+                                      dev->name, dev->sqq);
+                       ut_assert(dev->sqq != -1);
+               }
+       }
+
+       return 0;
+}
+DM_TEST(dm_test_all_have_seq, UT_TESTF_SCAN_PDATA);