1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3 * Tests for addrmap command
4 *
5 * Copyright (C) 2021, Bin Meng <bmeng.cn@gmail.com>
6 */
7
8 #include <common.h>
9 #include <console.h>
10 #include <test/suites.h>
11 #include <test/ut.h>
12
13 /* Declare a new addrmap test */
14 #define ADDRMAP_TEST(_name, _flags) UNIT_TEST(_name, _flags, addrmap_test)
15
16 /* Test 'addrmap' command output */
addrmap_test_basic(struct unit_test_state * uts)17 static int addrmap_test_basic(struct unit_test_state *uts)
18 {
19 ut_assertok(console_record_reset_enable());
20 ut_assertok(run_command("addrmap", 0));
21 ut_assert_nextline(" vaddr paddr size");
22 ut_assert_nextline("================ ================ ================");
23 /* There should be at least one entry */
24 ut_assertok(!ut_check_console_end(uts));
25
26 return 0;
27 }
28 ADDRMAP_TEST(addrmap_test_basic, UT_TESTF_CONSOLE_REC);
29
do_ut_addrmap(struct cmd_tbl * cmdtp,int flag,int argc,char * const argv[])30 int do_ut_addrmap(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
31 {
32 struct unit_test *tests = ll_entry_start(struct unit_test,
33 addrmap_test);
34 const int n_ents = ll_entry_count(struct unit_test, addrmap_test);
35
36 return cmd_ut_category("cmd_addrmap", "cmd_addrmap_", tests, n_ents,
37 argc, argv);
38 }
39