]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
test: dm: Expand ofnode options test with new helper
authorChristian Marangi <ansuelsmth@gmail.com>
Tue, 1 Oct 2024 12:24:44 +0000 (14:24 +0200)
committerTom Rini <trini@konsulko.com>
Thu, 10 Oct 2024 22:02:20 +0000 (16:02 -0600)
Expand ofnode options test with new generic helper for bool, int and
string.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
arch/sandbox/dts/test.dts
test/dm/ofnode.c

index 6706309720deccaa47b62bc023afe1a05e04d482..9bf44ae3b0bcc3ebce1778d2c2d91eeaea56eb4c 100644 (file)
                        bootscr-flash-size = /bits/ 64 <0x2000>;
                        boot-led = "sandbox:green";
                        activity-led = "sandbox:red";
+                       testing-bool;
+                       testing-int = <123>;
+                       testing-str = "testing";
                };
        };
 
index 859fc3ae0d02b4425c3e33d37cf7c9e228099452..ce996567c3c3a25a0b9baa9537c44d68a9251ea3 100644 (file)
@@ -614,6 +614,15 @@ static int dm_test_ofnode_options(struct unit_test_state *uts)
        u64 bootscr_address, bootscr_offset;
        u64 bootscr_flash_offset, bootscr_flash_size;
 
+       ut_assert(!ofnode_options_read_bool("missing"));
+       ut_assert(ofnode_options_read_bool("testing-bool"));
+
+       ut_asserteq(123, ofnode_options_read_int("testing-int", 0));
+       ut_asserteq(6, ofnode_options_read_int("missing", 6));
+
+       ut_assertnull(ofnode_options_read_str("missing"));
+       ut_asserteq_str("testing", ofnode_options_read_str("testing-str"));
+
        ut_assertok(ofnode_read_bootscript_address(&bootscr_address,
                                                   &bootscr_offset));
        ut_asserteq_64(0, bootscr_address);