blob: 7b8f49fd3751abd1e84936525d96b397fa59a104 [file] [log] [blame]
Bin Meng261fc062021-02-25 17:22:35 +08001// 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
Bin Meng261fc062021-02-25 17:22:35 +08008#include <console.h>
9#include <test/suites.h>
10#include <test/ut.h>
11
12/* Declare a new addrmap test */
13#define ADDRMAP_TEST(_name, _flags) UNIT_TEST(_name, _flags, addrmap_test)
14
15/* Test 'addrmap' command output */
16static int addrmap_test_basic(struct unit_test_state *uts)
17{
18 ut_assertok(console_record_reset_enable());
19 ut_assertok(run_command("addrmap", 0));
20 ut_assert_nextline(" vaddr paddr size");
21 ut_assert_nextline("================ ================ ================");
22 /* There should be at least one entry */
23 ut_assertok(!ut_check_console_end(uts));
24
25 return 0;
26}
27ADDRMAP_TEST(addrmap_test_basic, UT_TESTF_CONSOLE_REC);
28
29int do_ut_addrmap(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
30{
Simon Glassf2d59c02022-07-13 06:06:58 -060031 struct unit_test *tests = UNIT_TEST_SUITE_START(addrmap_test);
32 const int n_ents = UNIT_TEST_SUITE_COUNT(addrmap_test);
Bin Meng261fc062021-02-25 17:22:35 +080033
34 return cmd_ut_category("cmd_addrmap", "cmd_addrmap_", tests, n_ents,
35 argc, argv);
36}