aboutsummaryrefslogtreecommitdiff
path: root/test/cmd
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2021-03-15 12:15:38 -0400
committerTom Rini <trini@konsulko.com>2021-03-15 12:15:38 -0400
commit22fc991dafee0142fc6bf621e7bd558bd58020b4 (patch)
treee5da8826fd735de968519f432864dc1545d96017 /test/cmd
parent1876b390f31afca15de334e499aa071b0bf64a44 (diff)
parent4103e13534141c31e4e9bf40848ab3a61dabce81 (diff)
downloadu-boot-22fc991dafee0142fc6bf621e7bd558bd58020b4.zip
u-boot-22fc991dafee0142fc6bf621e7bd558bd58020b4.tar.gz
u-boot-22fc991dafee0142fc6bf621e7bd558bd58020b4.tar.bz2
Merge tag 'v2021.04-rc4' into next
Prepare v2021.04-rc4
Diffstat (limited to 'test/cmd')
-rw-r--r--test/cmd/Makefile1
-rw-r--r--test/cmd/addrmap.c38
2 files changed, 39 insertions, 0 deletions
diff --git a/test/cmd/Makefile b/test/cmd/Makefile
index c84df60..2cfe43a 100644
--- a/test/cmd/Makefile
+++ b/test/cmd/Makefile
@@ -6,6 +6,7 @@ ifdef CONFIG_HUSH_PARSER
obj-$(CONFIG_CONSOLE_RECORD) += test_echo.o
endif
obj-y += mem.o
+obj-$(CONFIG_CMD_ADDRMAP) += addrmap.o
obj-$(CONFIG_CMD_MEM_SEARCH) += mem_search.o
obj-$(CONFIG_CMD_PWM) += pwm.o
obj-$(CONFIG_CMD_SETEXPR) += setexpr.o
diff --git a/test/cmd/addrmap.c b/test/cmd/addrmap.c
new file mode 100644
index 0000000..fb74448
--- /dev/null
+++ b/test/cmd/addrmap.c
@@ -0,0 +1,38 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Tests for addrmap command
+ *
+ * Copyright (C) 2021, Bin Meng <bmeng.cn@gmail.com>
+ */
+
+#include <common.h>
+#include <console.h>
+#include <test/suites.h>
+#include <test/ut.h>
+
+/* Declare a new addrmap test */
+#define ADDRMAP_TEST(_name, _flags) UNIT_TEST(_name, _flags, addrmap_test)
+
+/* Test 'addrmap' command output */
+static int addrmap_test_basic(struct unit_test_state *uts)
+{
+ ut_assertok(console_record_reset_enable());
+ ut_assertok(run_command("addrmap", 0));
+ ut_assert_nextline(" vaddr paddr size");
+ ut_assert_nextline("================ ================ ================");
+ /* There should be at least one entry */
+ ut_assertok(!ut_check_console_end(uts));
+
+ return 0;
+}
+ADDRMAP_TEST(addrmap_test_basic, UT_TESTF_CONSOLE_REC);
+
+int do_ut_addrmap(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
+{
+ struct unit_test *tests = ll_entry_start(struct unit_test,
+ addrmap_test);
+ const int n_ents = ll_entry_count(struct unit_test, addrmap_test);
+
+ return cmd_ut_category("cmd_addrmap", "cmd_addrmap_", tests, n_ents,
+ argc, argv);
+}