diff mbox series

[v4,11/11] test: dm: Expand ofnode options test with new helper

Message ID 20240920225101.2008-12-ansuelsmth@gmail.com
State New
Headers show
Series led: introduce LED boot and activity function | expand

Commit Message

Christian Marangi Sept. 20, 2024, 10:50 p.m. UTC
Expand ofnode options test with new generic helper for bool, int and
string.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
 arch/sandbox/dts/test.dts | 3 +++
 test/dm/ofnode.c          | 9 +++++++++
 2 files changed, 12 insertions(+)
diff mbox series

Patch

diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
index 25859ad852d..e5381b56da4 100644
--- a/arch/sandbox/dts/test.dts
+++ b/arch/sandbox/dts/test.dts
@@ -103,6 +103,9 @@ 
 			bootscr-flash-size = /bits/ 64 <0x2000>;
 			boot-led = "sandbox:green";
 			activity-led = "sandbox:red";
+			testing-bool;
+			testing-int = <123>;
+			testing-str = "testing";
 		};
 	};
 
diff --git a/test/dm/ofnode.c b/test/dm/ofnode.c
index 39191d7f52b..7c0adcd596b 100644
--- a/test/dm/ofnode.c
+++ b/test/dm/ofnode.c
@@ -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);