[PATCH v6 2/3] test: cmd: add test for memsize
Frank Wunderlich
frank-w at public-files.de
Wed Feb 4 07:40:05 CET 2026
Am 4. Februar 2026 00:34:02 MEZ schrieb Tom Rini <trini at konsulko.com>:
>On Sun, Jan 25, 2026 at 02:12:52PM +0100, Frank Wunderlich wrote:
>
>> From: Frank Wunderlich <frank-w at public-files.de>
>>
>> Add a test for memsize command in same way as meminfo.
>>
>> Signed-off-by: Frank Wunderlich <frank-w at public-files.de>
>> ---
>> tested via:
>> $ ./u-boot -T -c "ut cmd cmd_test_memsize"
>> ...
>> Test: memsize: meminfo.c
>> Tests run: 1, 0 ms, average: 0 ms, failures: 0
>> ---
>> cmd/Kconfig | 1 +
>> test/cmd/meminfo.c | 17 +++++++++++++++++
>> 2 files changed, 18 insertions(+)
>>
>> diff --git a/cmd/Kconfig b/cmd/Kconfig
>> index be79bf0747df..2bafa156ca8a 100644
>> --- a/cmd/Kconfig
>> +++ b/cmd/Kconfig
>> @@ -927,6 +927,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.
>> diff --git a/test/cmd/meminfo.c b/test/cmd/meminfo.c
>> index 53b41e3b49e0..ba772a8b7616 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,20 @@ static int cmd_test_meminfo(struct unit_test_state *uts)
>>
>> return 0;
>> }
>> +
>> +/* Test 'memsize' command */
>> +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_meminfo, UTF_CONSOLE);
>> +CMD_TEST(cmd_test_memsize, UTF_CONSOLE);
>
>Since the new test isn't guarded with memsize, this fails on qemu-x86_64
>where meminfo is enabled, but memsize is not.
Does x86_64 test not use SANDBOX? Do i need to enable it somewhere else? Imho it should ve tested also there so guarding just prevents the test. But of course i can add guards for it.
regards Frank
More information about the U-Boot
mailing list