diff options
| author | Frank Wunderlich <[email protected]> | 2026-02-04 19:40:43 +0100 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2026-02-07 11:51:33 -0600 |
| commit | 8acc8a654643ca26b0bdd4af37010da7cc796753 (patch) | |
| tree | fc5d6b59da6341f2464fad36e603d390e6066df1 | |
| parent | e202eca183b0f1d6747b934482dc6249abdd742b (diff) | |
test: cmd: add test for memsize
Add a test for memsize command in same way as meminfo.
Signed-off-by: Frank Wunderlich <[email protected]>
| -rw-r--r-- | cmd/Kconfig | 1 | ||||
| -rw-r--r-- | test/cmd/meminfo.c | 20 |
2 files changed, 21 insertions, 0 deletions
diff --git a/cmd/Kconfig b/cmd/Kconfig index f12fcf6631e..8bdd04f348f 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -942,6 +942,7 @@ config CMD_MEMINFO_MAP config CMD_MEMSIZE bool "memsize" + default y if SANDBOX depends on CMD_MEMINFO help Get RAM via command for use in scripts. Print or assign decimal value diff --git a/test/cmd/meminfo.c b/test/cmd/meminfo.c index 40c3520496e..af2c19fa67d 100644 --- a/test/cmd/meminfo.c +++ b/test/cmd/meminfo.c @@ -7,6 +7,7 @@ */ #include <dm/test.h> +#include <env.h> #include <test/cmd.h> #include <test/ut.h> @@ -39,4 +40,23 @@ static int cmd_test_meminfo(struct unit_test_state *uts) 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 |
