Bin Meng | 261fc06 | 2021-02-25 17:22:35 +0800 | [diff] [blame] | 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 | |
Bin Meng | 261fc06 | 2021-02-25 17:22:35 +0800 | [diff] [blame] | 8 | #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 */ |
| 16 | static int addrmap_test_basic(struct unit_test_state *uts) |
| 17 | { |
Bin Meng | 261fc06 | 2021-02-25 17:22:35 +0800 | [diff] [blame] | 18 | ut_assertok(run_command("addrmap", 0)); |
| 19 | ut_assert_nextline(" vaddr paddr size"); |
| 20 | ut_assert_nextline("================ ================ ================"); |
| 21 | /* There should be at least one entry */ |
| 22 | ut_assertok(!ut_check_console_end(uts)); |
| 23 | |
| 24 | return 0; |
| 25 | } |
Simon Glass | 11fcfa3 | 2024-08-22 07:57:50 -0600 | [diff] [blame] | 26 | ADDRMAP_TEST(addrmap_test_basic, UTF_CONSOLE); |
Bin Meng | 261fc06 | 2021-02-25 17:22:35 +0800 | [diff] [blame] | 27 | |
| 28 | int do_ut_addrmap(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) |
| 29 | { |
Simon Glass | f2d59c0 | 2022-07-13 06:06:58 -0600 | [diff] [blame] | 30 | struct unit_test *tests = UNIT_TEST_SUITE_START(addrmap_test); |
| 31 | const int n_ents = UNIT_TEST_SUITE_COUNT(addrmap_test); |
Bin Meng | 261fc06 | 2021-02-25 17:22:35 +0800 | [diff] [blame] | 32 | |
| 33 | return cmd_ut_category("cmd_addrmap", "cmd_addrmap_", tests, n_ents, |
| 34 | argc, argv); |
| 35 | } |