mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-03-20 05:11:03 +01:00
Frank Wunderlich <frank-w@public-files.de> says: Add command for getting ramsize in scripts Link: https://lore.kernel.org/r/20260204184045.111808-1-linux@fw-web.de
73 lines
1.7 KiB
C
73 lines
1.7 KiB
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* Test for 'meminfo' command
|
|
*
|
|
* Copyright 2024 Google LLC
|
|
* Written by Simon Glass <sjg@chromium.org>
|
|
*/
|
|
|
|
#include <dm/test.h>
|
|
#include <env.h>
|
|
#include <test/cmd.h>
|
|
#include <test/ut.h>
|
|
|
|
/* Test 'meminfo' command */
|
|
static int cmd_test_meminfo(struct unit_test_state *uts)
|
|
{
|
|
ut_assertok(run_command("meminfo", 0));
|
|
ut_assert_nextlinen("DRAM: ");
|
|
|
|
if (!IS_ENABLED(CMD_MEMINFO_MAP))
|
|
return 0;
|
|
|
|
ut_assert_nextline_empty();
|
|
|
|
ut_assert_nextline("Region Base Size End Gap");
|
|
ut_assert_nextlinen("-");
|
|
|
|
/* For now we don't worry about checking the values */
|
|
if (IS_ENABLED(CONFIG_VIDEO))
|
|
ut_assert_nextlinen("video");
|
|
if (IS_ENABLED(CONFIG_TRACE))
|
|
ut_assert_nextlinen("trace");
|
|
ut_assert_nextlinen("code");
|
|
ut_assert_nextlinen("malloc");
|
|
ut_assert_nextlinen("board_info");
|
|
ut_assert_nextlinen("global_data");
|
|
ut_assert_nextlinen("devicetree");
|
|
if (IS_ENABLED(CONFIG_BOOTSTAGE))
|
|
ut_assert_nextlinen("bootstage");
|
|
if (IS_ENABLED(CONFIG_BLOBLIST))
|
|
ut_assert_nextlinen("bloblist");
|
|
ut_assert_nextlinen("stack");
|
|
|
|
/* we expect at least one lmb line, but don't know how many */
|
|
if (IS_ENABLED(CONFIG_LMB))
|
|
ut_assert_nextlinen("lmb");
|
|
ut_assert_skip_to_linen("free");
|
|
|
|
ut_assert_console_end();
|
|
|
|
return 0;
|
|
}
|
|
|
|
CMD_TEST(cmd_test_meminfo, UTF_CONSOLE);
|
|
|
|
/* Test 'memsize' command */
|
|
#ifdef CONFIG_CMD_MEMSIZE
|
|
static int cmd_test_memsize(struct unit_test_state *uts)
|
|
{
|
|
ut_assertok(run_command("memsize", 0));
|
|
ut_assert_nextline("256 MiB");
|
|
ut_assert_console_end();
|
|
|
|
ut_assertok(run_command("memsize memsz", 0));
|
|
ut_asserteq_str("256", env_get("memsz"));
|
|
ut_assert_console_end();
|
|
|
|
return 0;
|
|
}
|
|
|
|
CMD_TEST(cmd_test_memsize, UTF_CONSOLE);
|
|
#endif
|