[PATCH v5 01/46] bdinfo: Add tests for serial settings

Simon Glass sjg at chromium.org
Sun Jul 16 05:38:34 CEST 2023


Since the original patch was written, tests have been added for the
'bdinfo' command. Add the missing pieces so that the tests pass.

Signed-off-by: Simon Glass <sjg at chromium.org>
Fixes: 68130503fbd ("bdinfo: Show information about the serial port")
---

(no changes since v1)

 test/cmd/bdinfo.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/test/cmd/bdinfo.c b/test/cmd/bdinfo.c
index cddf1a46d491..6480393fd5d8 100644
--- a/test/cmd/bdinfo.c
+++ b/test/cmd/bdinfo.c
@@ -16,6 +16,7 @@
 #include <env.h>
 #include <lmb.h>
 #include <net.h>
+#include <serial.h>
 #include <video.h>
 #include <vsprintf.h>
 #include <asm/cache.h>
@@ -191,6 +192,19 @@ static int bdinfo_test_move(struct unit_test_state *uts)
 			ut_assert_nextline("devicetree  = %s", fdtdec_get_srcname());
 	}
 
+	if (IS_ENABLED(CONFIG_DM_SERIAL)) {
+		struct serial_device_info info;
+
+		ut_assertnonnull(gd->cur_serial_dev);
+		ut_assertok(serial_getinfo(gd->cur_serial_dev, &info));
+
+		ut_assertok(test_num_l(uts, "serial addr", info.addr));
+		ut_assertok(test_num_l(uts, " width", info.reg_width));
+		ut_assertok(test_num_l(uts, " shift", info.reg_shift));
+		ut_assertok(test_num_l(uts, " offset", info.reg_offset));
+		ut_assertok(test_num_l(uts, " clock", info.clock));
+	}
+
 	ut_assertok(ut_check_console_end(uts));
 
 	return 0;
-- 
2.41.0.455.g037347b96a-goog



More information about the U-Boot mailing list