mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2025-12-19 08:21:27 +01:00
Update the command to show the size and selected file, since this is useful information at times. Add a heading so it is clear what each field refers to. Add a simple test as well. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
41 lines
969 B
C
41 lines
969 B
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* Tests for qfw command
|
|
*
|
|
* Copyright 2025 Simon Glass <sjg@chromium.org>
|
|
*/
|
|
|
|
#include <console.h>
|
|
#include <dm.h>
|
|
#include <mapmem.h>
|
|
#include <qfw.h>
|
|
#include <dm/test.h>
|
|
#include <test/cmd.h>
|
|
#include <test/ut.h>
|
|
|
|
/* Test 'qfw list' command */
|
|
static int cmd_test_qfw_list(struct unit_test_state *uts)
|
|
{
|
|
struct fw_cfg_file_iter iter;
|
|
struct fw_file *file;
|
|
struct udevice *dev;
|
|
|
|
ut_assertok(uclass_first_device_err(UCLASS_QFW, &dev));
|
|
|
|
ut_assertok(run_command("qfw list", 0));
|
|
ut_assert_nextline(" Addr Size Sel Name");
|
|
ut_assert_nextlinen("--");
|
|
|
|
for (file = qfw_file_iter_init(dev, &iter); !qfw_file_iter_end(&iter);
|
|
file = qfw_file_iter_next(&iter)) {
|
|
ut_assert_nextline("%16lx %8x %3x %-48s", file->addr,
|
|
be32_to_cpu(file->cfg.size),
|
|
be16_to_cpu(file->cfg.select),
|
|
file->cfg.name);
|
|
}
|
|
ut_assert_console_end();
|
|
|
|
return 0;
|
|
}
|
|
CMD_TEST(cmd_test_qfw_list, UTF_CONSOLE);
|