addrmap.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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. #include <common.h>
  8. #include <console.h>
  9. #include <test/suites.h>
  10. #include <test/ut.h>
  11. /* Declare a new addrmap test */
  12. #define ADDRMAP_TEST(_name, _flags) UNIT_TEST(_name, _flags, addrmap_test)
  13. /* Test 'addrmap' command output */
  14. static int addrmap_test_basic(struct unit_test_state *uts)
  15. {
  16. ut_assertok(console_record_reset_enable());
  17. ut_assertok(run_command("addrmap", 0));
  18. ut_assert_nextline(" vaddr paddr size");
  19. ut_assert_nextline("================ ================ ================");
  20. /* There should be at least one entry */
  21. ut_assertok(!ut_check_console_end(uts));
  22. return 0;
  23. }
  24. ADDRMAP_TEST(addrmap_test_basic, UT_TESTF_CONSOLE_REC);
  25. int do_ut_addrmap(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
  26. {
  27. struct unit_test *tests = ll_entry_start(struct unit_test,
  28. addrmap_test);
  29. const int n_ents = ll_entry_count(struct unit_test, addrmap_test);
  30. return cmd_ut_category("cmd_addrmap", "cmd_addrmap_", tests, n_ents,
  31. argc, argv);
  32. }