summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSimon Glass <[email protected]>2025-10-29 15:14:32 +0100
committerHeinrich Schuchardt <[email protected]>2025-11-06 23:26:27 +0100
commit74545d49c7d1558473118fab0f74de3c5976ee9b (patch)
tree1e86b48d89c3b14e13041a92b1bde5623165b6fb /test
parentddc916334a7a7e180b532dbb2cf1b778466d2b9b (diff)
qfw: Add more fields and a heading to qfw list
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 <[email protected]> Signed-off-by: Heinrich Schuchardt <[email protected]>
Diffstat (limited to 'test')
-rw-r--r--test/cmd/Makefile1
-rw-r--r--test/cmd/qfw.c40
2 files changed, 41 insertions, 0 deletions
diff --git a/test/cmd/Makefile b/test/cmd/Makefile
index e71c80a5b2e..98731d9bdff 100644
--- a/test/cmd/Makefile
+++ b/test/cmd/Makefile
@@ -27,6 +27,7 @@ obj-$(CONFIG_CMD_MEM_SEARCH) += mem_search.o
ifdef CONFIG_CMD_PCI
obj-$(CONFIG_CMD_PCI_MPS) += pci_mps.o
endif
+obj-$(CONFIG_CMD_QFW) += qfw.o
obj-$(CONFIG_CMD_SEAMA) += seama.o
ifdef CONFIG_SANDBOX
obj-$(CONFIG_CMD_MBR) += mbr.o
diff --git a/test/cmd/qfw.c b/test/cmd/qfw.c
new file mode 100644
index 00000000000..e615a82b31a
--- /dev/null
+++ b/test/cmd/qfw.c
@@ -0,0 +1,40 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Tests for qfw command
+ *
+ * Copyright 2025 Simon Glass <[email protected]>
+ */
+
+#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);