* [PATCH 1/3] gunzip: Add ability to disable progress indicator
@ 2026-01-27 23:57 Marek Vasut
2026-01-27 23:57 ` [PATCH 2/3] configs: sandbox: Enable zip command Marek Vasut
` (2 more replies)
0 siblings, 3 replies; 15+ messages in thread
From: Marek Vasut @ 2026-01-27 23:57 UTC (permalink / raw)
To: u-boot
Cc: Marek Vasut, Alexander Graf, Heinrich Schuchardt,
Ilias Apalodimas, Jerome Forissier, Mattijs Korpershoek,
Neil Armstrong, Peng Fan, Quentin Schulz, Simon Glass, Tom Rini,
Yuya Hamamachi
Introduce new environment variable, 'gzwrite_quiet', which disables
the progress indicator during decompress-write. This is mainly meant
to prevent disturbing unit test which responds badly to the in-place
progress update and reduce UART traffic. By default, the indicator is
left enabled.
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
---
Cc: Alexander Graf <agraf@csgraf.de>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Jerome Forissier <jerome@forissier.org>
Cc: Mattijs Korpershoek <mkorpershoek@kernel.org>
Cc: Neil Armstrong <neil.armstrong@linaro.org>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Quentin Schulz <quentin.schulz@cherry.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Yuya Hamamachi <yuya.hamamachi.sx@renesas.com>
Cc: u-boot@lists.denx.de
---
lib/gunzip.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/lib/gunzip.c b/lib/gunzip.c
index 040450c0e79..d31bbb2ba03 100644
--- a/lib/gunzip.c
+++ b/lib/gunzip.c
@@ -83,10 +83,15 @@ __rcode int gunzip(void *dst, int dstlen, unsigned char *src, unsigned long *len
}
#ifdef CONFIG_CMD_UNZIP
+static bool quiet;
+
__weak
void gzwrite_progress_init(ulong expectedsize)
{
- putc('\n');
+ quiet = env_get_yesno("gzwrite_quiet") == 1;
+
+ if (!quiet)
+ putc('\n');
}
__weak
@@ -94,7 +99,7 @@ void gzwrite_progress(int iteration,
ulong bytes_written,
ulong total_bytes)
{
- if (0 == (iteration & 3))
+ if (!quiet && !(iteration & 3))
printf("%lu/%lu\r", bytes_written, total_bytes);
}
--
2.51.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 2/3] configs: sandbox: Enable zip command
2026-01-27 23:57 [PATCH 1/3] gunzip: Add ability to disable progress indicator Marek Vasut
@ 2026-01-27 23:57 ` Marek Vasut
2026-01-29 16:17 ` Mattijs Korpershoek
2026-01-27 23:57 ` [PATCH 3/3] test: cmd: Add test for zip/unzip/gzwrite commands Marek Vasut
2026-01-29 16:17 ` [PATCH 1/3] gunzip: Add ability to disable progress indicator Mattijs Korpershoek
2 siblings, 1 reply; 15+ messages in thread
From: Marek Vasut @ 2026-01-27 23:57 UTC (permalink / raw)
To: u-boot
Cc: Marek Vasut, Alexander Graf, Heinrich Schuchardt,
Ilias Apalodimas, Jerome Forissier, Mattijs Korpershoek,
Neil Armstrong, Peng Fan, Quentin Schulz, Simon Glass, Tom Rini,
Yuya Hamamachi
What is not being built and tested in CI, breaks. Enable the 'zip'
command in sandbox to get it build tested in preparation for an
actual unit test.
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
---
Cc: Alexander Graf <agraf@csgraf.de>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Jerome Forissier <jerome@forissier.org>
Cc: Mattijs Korpershoek <mkorpershoek@kernel.org>
Cc: Neil Armstrong <neil.armstrong@linaro.org>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Quentin Schulz <quentin.schulz@cherry.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Yuya Hamamachi <yuya.hamamachi.sx@renesas.com>
Cc: u-boot@lists.denx.de
---
configs/sandbox64_defconfig | 1 +
configs/sandbox_defconfig | 1 +
2 files changed, 2 insertions(+)
diff --git a/configs/sandbox64_defconfig b/configs/sandbox64_defconfig
index 440e5efa340..60a30d04875 100644
--- a/configs/sandbox64_defconfig
+++ b/configs/sandbox64_defconfig
@@ -47,6 +47,7 @@ CONFIG_LOOPW=y
CONFIG_CMD_MD5SUM=y
CONFIG_CMD_MX_CYCLIC=y
CONFIG_CMD_MEMTEST=y
+CONFIG_CMD_ZIP=y
CONFIG_CMD_BCB=y
CONFIG_CMD_CLK=y
CONFIG_CMD_DEMO=y
diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig
index 92fb5f844b1..f9e3c921d3d 100644
--- a/configs/sandbox_defconfig
+++ b/configs/sandbox_defconfig
@@ -75,6 +75,7 @@ CONFIG_CMD_MD5SUM=y
CONFIG_CMD_MEM_SEARCH=y
CONFIG_CMD_MX_CYCLIC=y
CONFIG_CMD_MEMTEST=y
+CONFIG_CMD_ZIP=y
CONFIG_CMD_CLK=y
CONFIG_CMD_DEMO=y
CONFIG_CMD_FPGA_LOADP=y
--
2.51.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 3/3] test: cmd: Add test for zip/unzip/gzwrite commands
2026-01-27 23:57 [PATCH 1/3] gunzip: Add ability to disable progress indicator Marek Vasut
2026-01-27 23:57 ` [PATCH 2/3] configs: sandbox: Enable zip command Marek Vasut
@ 2026-01-27 23:57 ` Marek Vasut
2026-01-29 16:26 ` Mattijs Korpershoek
2026-01-29 16:17 ` [PATCH 1/3] gunzip: Add ability to disable progress indicator Mattijs Korpershoek
2 siblings, 1 reply; 15+ messages in thread
From: Marek Vasut @ 2026-01-27 23:57 UTC (permalink / raw)
To: u-boot
Cc: Marek Vasut, Alexander Graf, Heinrich Schuchardt,
Ilias Apalodimas, Jerome Forissier, Mattijs Korpershoek,
Neil Armstrong, Peng Fan, Quentin Schulz, Simon Glass, Tom Rini,
Yuya Hamamachi
Add simple test for zip/unzip/gzwrite commands. The test works as
follows. First, create three buffers with a bit of space between
each of them, fill them with random data, then compress data in
buffer 1 into buffer 2, decompress data in buffer 2 either directly
into buffer 3 or into MMC 1 and then read them back into buffer 3,
and finally compare buffer 1 and buffer 3, they have to be identical.
The buffers are filled with random data to detect out of bounds writes.
Test for various sizes, both small and large and unaligned.
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
---
Cc: Alexander Graf <agraf@csgraf.de>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Jerome Forissier <jerome@forissier.org>
Cc: Mattijs Korpershoek <mkorpershoek@kernel.org>
Cc: Neil Armstrong <neil.armstrong@linaro.org>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Quentin Schulz <quentin.schulz@cherry.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Yuya Hamamachi <yuya.hamamachi.sx@renesas.com>
Cc: u-boot@lists.denx.de
---
arch/sandbox/dts/test.dts | 7 +++
test/cmd/Makefile | 4 ++
test/cmd/unzip.c | 127 ++++++++++++++++++++++++++++++++++++++
test/py/tests/test_ut.py | 6 ++
4 files changed, 144 insertions(+)
create mode 100644 test/cmd/unzip.c
diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
index cd53c170171..a8ff0a4993a 100644
--- a/arch/sandbox/dts/test.dts
+++ b/arch/sandbox/dts/test.dts
@@ -1268,6 +1268,13 @@
filename = "mmc8.img";
};
+ /* This is used for zip/unzip/gzwrite tests. */
+ mmc9 {
+ status = "disabled";
+ compatible = "sandbox,mmc";
+ filename = "mmc9.img";
+ };
+
pch {
compatible = "sandbox,pch";
};
diff --git a/test/cmd/Makefile b/test/cmd/Makefile
index 2476068aee6..273009a034f 100644
--- a/test/cmd/Makefile
+++ b/test/cmd/Makefile
@@ -45,3 +45,7 @@ endif
obj-$(CONFIG_ARM_FFA_TRANSPORT) += armffa.o
endif
obj-$(CONFIG_CMD_SPAWN) += spawn.o
+
+ifdef CONFIG_CMD_ZIP
+obj-$(CONFIG_CMD_UNZIP) += unzip.o
+endif
diff --git a/test/cmd/unzip.c b/test/cmd/unzip.c
new file mode 100644
index 00000000000..725fcf91458
--- /dev/null
+++ b/test/cmd/unzip.c
@@ -0,0 +1,127 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Tests for zip/unzip/gzwrite commands
+ *
+ * Copyright 2026, Marek Vasut <marek.vasut+renesas@mailbox.org>
+ */
+
+#include <command.h>
+#include <env.h>
+#include <dm.h>
+#include <dm/lists.h>
+#include <dm/test.h>
+#include <linux/sizes.h>
+#include <mapmem.h>
+#include <part.h>
+#include <test/cmd.h>
+#include <test/test.h>
+#include <test/ut.h>
+#include <u-boot/crc.h>
+
+static const int sizes[] = { 32, SZ_1K, SZ_4K, SZ_1M, SZ_16M, SZ_1M - 1, SZ_1M + 1, 6758401 };
+
+static int do_test_cmd_zip_unzip(struct unit_test_state *uts, const int size,
+ const bool gzwrite)
+{
+ env_set_hex("size", size);
+
+ /*
+ * Prepare three buffers, $loadadd, $encaddr, $decaddr, and
+ * fill them all with random data. Add slight space between
+ * the compressed buffer 'encaddr' and uncompressed buffer
+ * 'decaddr', because the compressed data with gzip header
+ * might be longer than uncompressed source data 'loadaddr',
+ * and if the uncompressed data buffer 'decaddr' followed
+ * 'encaddr', the decompression could corrupt end of 'encaddr'
+ * buffer.
+ */
+ ut_assertok(run_command("setexpr encaddr $loadaddr + $size", 0));
+ ut_assertok(run_command("setexpr encaddr $encaddr + 0x10000", 0));
+
+ ut_assertok(run_command("setexpr decaddr $encaddr + $size", 0));
+ ut_assertok(run_command("setexpr decaddr $decaddr + 0x10000", 0));
+
+ ut_assertok(run_command("random $loadaddr $size", 0));
+ ut_assert_nextline("%d bytes filled with random data", size);
+ ut_assertok(run_command("random $encaddr $size", 0));
+ ut_assert_nextline("%d bytes filled with random data", size);
+ ut_assertok(run_command("random $decaddr $size", 0));
+ ut_assert_nextline("%d bytes filled with random data", size);
+
+ /* Compress data in $loadaddr into $encaddr */
+ ut_assertok(run_command("zip $loadaddr $size $encaddr", 0));
+ console_record_readline(uts->actual_str, sizeof(uts->actual_str));
+ ut_assert(strstr(uts->actual_str, "Compressed size: "));
+
+ if (gzwrite) {
+ unsigned int sectsize = DIV_ROUND_UP(size, 512);
+ unsigned char *db = map_sysmem(env_get_ulong("loadaddr", 16, 0), size);
+ u32 crc = crc32(0, db, size);
+
+ ut_assertok(run_command("gzwrite mmc 9 $encaddr $filesize", 0));
+ ut_assert_skipline(); /* Empty line */
+ ut_assert_nextline("\t%u bytes, crc 0x%08x", size, crc);
+
+ env_set_hex("sectsize", sectsize);
+ ut_assertok(run_command("mmc read $decaddr 0 $sectsize", 0));
+ ut_assert_nextline("MMC read: dev # 9, block # 0, count %u ... %u blocks read: OK",
+ sectsize, sectsize);
+ } else {
+ /* Decompress data in $encaddr into $decaddr */
+ ut_assertok(run_command("unzip $encaddr $decaddr $filesize", 0));
+ ut_assert_nextline("Uncompressed size: %u = 0x%X", size, size);
+ }
+
+ /* Input data and compressed-decompressed data */
+ ut_assertok(run_command("cmp.b $loadaddr $decaddr $size", 0));
+ ut_assert_nextline("Total of %u byte(s) were the same", size);
+
+ ut_assert_console_end();
+
+ return 0;
+}
+
+static int dm_test_cmd_zip_unzip(struct unit_test_state *uts)
+{
+ int i, ret;
+
+ for (i = 0; i < ARRAY_SIZE(sizes); i++) {
+ ret = do_test_cmd_zip_unzip(uts, sizes[i], false);
+ if (ret)
+ return ret;
+ }
+
+ return 0;
+}
+DM_TEST(dm_test_cmd_zip_unzip, UTF_CONSOLE);
+
+static int dm_test_cmd_zip_gzwrite(struct unit_test_state *uts)
+{
+ struct blk_desc *mmc_dev_desc;
+ struct udevice *dev;
+ ofnode root, node;
+ int i, ret;
+
+ /* Enable the mmc9 node for this test */
+ root = oftree_root(oftree_default());
+ node = ofnode_find_subnode(root, "mmc9");
+ ut_assert(ofnode_valid(node));
+ ut_assertok(lists_bind_fdt(gd->dm_root, node, &dev, NULL, false));
+
+ ut_asserteq(9, blk_get_device_by_str("mmc", "9", &mmc_dev_desc));
+ ut_assertok(run_commandf("mmc dev 9"));
+ ut_assert_nextline("switch to partitions #0, OK");
+ ut_assert_nextline("mmc9 is current device");
+
+ /* Disable gzwrite progress indication */
+ env_set("gzwrite_quiet", "yes");
+
+ for (i = 0; i < ARRAY_SIZE(sizes); i++) {
+ ret = do_test_cmd_zip_unzip(uts, sizes[i], true);
+ if (ret)
+ return ret;
+ }
+
+ return 0;
+}
+DM_TEST(dm_test_cmd_zip_gzwrite, UTF_CONSOLE);
diff --git a/test/py/tests/test_ut.py b/test/py/tests/test_ut.py
index 6d535b5206d..b7166d59943 100644
--- a/test/py/tests/test_ut.py
+++ b/test/py/tests/test_ut.py
@@ -522,6 +522,12 @@ def test_ut_dm_init(ubman):
with open(fn, 'wb') as fh:
fh.write(data)
+ mmc_dev = 9
+ fn = os.path.join(ubman.config.source_dir, f'mmc{mmc_dev}.img')
+ data = b'\x00' * (32 * 1024 * 1024)
+ with open(fn, 'wb') as fh:
+ fh.write(data)
+
def setup_efi_image(ubman):
"""Create a 20MB disk image with an EFI app on it"""
--
2.51.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH 1/3] gunzip: Add ability to disable progress indicator
2026-01-27 23:57 [PATCH 1/3] gunzip: Add ability to disable progress indicator Marek Vasut
2026-01-27 23:57 ` [PATCH 2/3] configs: sandbox: Enable zip command Marek Vasut
2026-01-27 23:57 ` [PATCH 3/3] test: cmd: Add test for zip/unzip/gzwrite commands Marek Vasut
@ 2026-01-29 16:17 ` Mattijs Korpershoek
2026-01-29 16:33 ` Marek Vasut
2 siblings, 1 reply; 15+ messages in thread
From: Mattijs Korpershoek @ 2026-01-29 16:17 UTC (permalink / raw)
To: Marek Vasut, u-boot
Cc: Marek Vasut, Alexander Graf, Heinrich Schuchardt,
Ilias Apalodimas, Jerome Forissier, Mattijs Korpershoek,
Neil Armstrong, Peng Fan, Quentin Schulz, Simon Glass, Tom Rini,
Yuya Hamamachi
Hi Marek,
Thank you for the patch.
On Wed, Jan 28, 2026 at 00:57, Marek Vasut <marek.vasut+renesas@mailbox.org> wrote:
> Introduce new environment variable, 'gzwrite_quiet', which disables
> the progress indicator during decompress-write. This is mainly meant
> to prevent disturbing unit test which responds badly to the in-place
> progress update and reduce UART traffic. By default, the indicator is
> left enabled.
>
> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
> ---
> Cc: Alexander Graf <agraf@csgraf.de>
> Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
> Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> Cc: Jerome Forissier <jerome@forissier.org>
> Cc: Mattijs Korpershoek <mkorpershoek@kernel.org>
> Cc: Neil Armstrong <neil.armstrong@linaro.org>
> Cc: Peng Fan <peng.fan@nxp.com>
> Cc: Quentin Schulz <quentin.schulz@cherry.de>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Tom Rini <trini@konsulko.com>
> Cc: Yuya Hamamachi <yuya.hamamachi.sx@renesas.com>
> Cc: u-boot@lists.denx.de
> ---
> lib/gunzip.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/lib/gunzip.c b/lib/gunzip.c
> index 040450c0e79..d31bbb2ba03 100644
> --- a/lib/gunzip.c
> +++ b/lib/gunzip.c
> @@ -83,10 +83,15 @@ __rcode int gunzip(void *dst, int dstlen, unsigned char *src, unsigned long *len
> }
>
> #ifdef CONFIG_CMD_UNZIP
> +static bool quiet;
> +
> __weak
> void gzwrite_progress_init(ulong expectedsize)
> {
> - putc('\n');
> + quiet = env_get_yesno("gzwrite_quiet") == 1;
I've tried to test the series with:
$ ./test/py/test.py --bd sandbox --build -k ut
(I know ut might not the right filter for this test, but I always test 'ut'
before testing other things)
But I see:
+make O=/var/home/mkorpershoek/work/upstream/u-boot/build-sandbox -s sandbox_defconfig
+make O=/var/home/mkorpershoek/work/upstream/u-boot/build-sandbox -s -j14
ld: warning: enabling an executable stack because of -z execstack command line option
ld: warning: enabling an executable stack because of -z execstack command line option
ld: warning: enabling an executable stack because of -z execstack command line option
ld: warning: enabling an executable stack because of -z execstack command line option
ld: warning: enabling an executable stack because of -z execstack command line option
ld: warning: enabling an executable stack because of -z execstack command line option
ld: warning: enabling an executable stack because of -z execstack command line option
ld: warning: enabling an executable stack because of -z execstack command line option
../lib/gunzip.c: In function ‘gzwrite_progress_init’:
../lib/gunzip.c:91:17: error: implicit declaration of function ‘env_get_yesno’ [-Wimplicit-function-declaration]
91 | quiet = env_get_yesno("gzwrite_quiet") == 1;
| ^~~~~~~~~~~~~
make[2]: *** [../scripts/Makefile.build:271: lib/gunzip.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [/var/home/mkorpershoek/work/upstream/u-boot/Makefile:2191: lib] Error 2
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:189: __sub-make] Error 2
Adding env.h inclusion as following fixes it:
diff --git a/lib/gunzip.c b/lib/gunzip.c
index ed05f1d64d7d..98acf4c5b2a7 100644
--- a/lib/gunzip.c
+++ b/lib/gunzip.c
@@ -8,6 +8,7 @@
#include <command.h>
#include <console.h>
#include <div64.h>
+#include <env.h>
#include <gzip.h>
#include <image.h>
#include <malloc.h>
Maybe this should be included conditionally depending on the command
being enabled or not?
> +
> + if (!quiet)
> + putc('\n');
> }
>
> __weak
> @@ -94,7 +99,7 @@ void gzwrite_progress(int iteration,
> ulong bytes_written,
> ulong total_bytes)
> {
> - if (0 == (iteration & 3))
> + if (!quiet && !(iteration & 3))
> printf("%lu/%lu\r", bytes_written, total_bytes);
> }
>
> --
> 2.51.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH 2/3] configs: sandbox: Enable zip command
2026-01-27 23:57 ` [PATCH 2/3] configs: sandbox: Enable zip command Marek Vasut
@ 2026-01-29 16:17 ` Mattijs Korpershoek
0 siblings, 0 replies; 15+ messages in thread
From: Mattijs Korpershoek @ 2026-01-29 16:17 UTC (permalink / raw)
To: Marek Vasut, u-boot
Cc: Marek Vasut, Alexander Graf, Heinrich Schuchardt,
Ilias Apalodimas, Jerome Forissier, Mattijs Korpershoek,
Neil Armstrong, Peng Fan, Quentin Schulz, Simon Glass, Tom Rini,
Yuya Hamamachi
Hi Marek,
Thank you for the patch.
On Wed, Jan 28, 2026 at 00:57, Marek Vasut <marek.vasut+renesas@mailbox.org> wrote:
> What is not being built and tested in CI, breaks. Enable the 'zip'
> command in sandbox to get it build tested in preparation for an
> actual unit test.
>
> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
> ---
> Cc: Alexander Graf <agraf@csgraf.de>
> Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
> Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> Cc: Jerome Forissier <jerome@forissier.org>
> Cc: Mattijs Korpershoek <mkorpershoek@kernel.org>
> Cc: Neil Armstrong <neil.armstrong@linaro.org>
> Cc: Peng Fan <peng.fan@nxp.com>
> Cc: Quentin Schulz <quentin.schulz@cherry.de>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Tom Rini <trini@konsulko.com>
> Cc: Yuya Hamamachi <yuya.hamamachi.sx@renesas.com>
> Cc: u-boot@lists.denx.de
> ---
> configs/sandbox64_defconfig | 1 +
> configs/sandbox_defconfig | 1 +
> 2 files changed, 2 insertions(+)
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 3/3] test: cmd: Add test for zip/unzip/gzwrite commands
2026-01-27 23:57 ` [PATCH 3/3] test: cmd: Add test for zip/unzip/gzwrite commands Marek Vasut
@ 2026-01-29 16:26 ` Mattijs Korpershoek
2026-01-29 16:31 ` Marek Vasut
0 siblings, 1 reply; 15+ messages in thread
From: Mattijs Korpershoek @ 2026-01-29 16:26 UTC (permalink / raw)
To: Marek Vasut, u-boot
Cc: Marek Vasut, Alexander Graf, Heinrich Schuchardt,
Ilias Apalodimas, Jerome Forissier, Mattijs Korpershoek,
Neil Armstrong, Peng Fan, Quentin Schulz, Simon Glass, Tom Rini,
Yuya Hamamachi
Hi Marek,
Thank you for the patch.
On Wed, Jan 28, 2026 at 00:57, Marek Vasut <marek.vasut+renesas@mailbox.org> wrote:
> Add simple test for zip/unzip/gzwrite commands. The test works as
> follows. First, create three buffers with a bit of space between
> each of them, fill them with random data, then compress data in
> buffer 1 into buffer 2, decompress data in buffer 2 either directly
> into buffer 3 or into MMC 1 and then read them back into buffer 3,
> and finally compare buffer 1 and buffer 3, they have to be identical.
>
> The buffers are filled with random data to detect out of bounds writes.
> Test for various sizes, both small and large and unaligned.
>
> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
I've tested this with
$ ./test/py/test.py --bd sandbox --build -k ut
Followed by:
$ ./test/py/test.py --bd sandbox --build -k cmd_zip
And I see:
FAILED test/py/tests/test_ut.py::test_ut[ut_dm_dm_test_cmd_zip_gzwrite] - ValueError: U-Boot exited with signal 11 (SIGSEGV)
FAILED test/py/tests/test_ut.py::test_ut[ut_dm_dm_test_cmd_zip_unzip] - ValueError: U-Boot exited with signal 11 (SIGSEGV)
The full logs are available here:
https://paste.debian.net/hidden/704e0be8
(note that the version is reported as dirty because I added a small to
diff to fix the compile issue I reported in [1])
[1] https://lore.kernel.org/all/87wm10mm0g.fsf@kernel.org/
> ---
> Cc: Alexander Graf <agraf@csgraf.de>
> Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
> Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> Cc: Jerome Forissier <jerome@forissier.org>
> Cc: Mattijs Korpershoek <mkorpershoek@kernel.org>
> Cc: Neil Armstrong <neil.armstrong@linaro.org>
> Cc: Peng Fan <peng.fan@nxp.com>
> Cc: Quentin Schulz <quentin.schulz@cherry.de>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Tom Rini <trini@konsulko.com>
> Cc: Yuya Hamamachi <yuya.hamamachi.sx@renesas.com>
> Cc: u-boot@lists.denx.de
> ---
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 3/3] test: cmd: Add test for zip/unzip/gzwrite commands
2026-01-29 16:26 ` Mattijs Korpershoek
@ 2026-01-29 16:31 ` Marek Vasut
2026-01-29 19:34 ` Mattijs Korpershoek
0 siblings, 1 reply; 15+ messages in thread
From: Marek Vasut @ 2026-01-29 16:31 UTC (permalink / raw)
To: Mattijs Korpershoek, u-boot
Cc: Alexander Graf, Heinrich Schuchardt, Ilias Apalodimas,
Jerome Forissier, Neil Armstrong, Peng Fan, Quentin Schulz,
Simon Glass, Tom Rini, Yuya Hamamachi
On 1/29/26 5:26 PM, Mattijs Korpershoek wrote:
Hi,
> On Wed, Jan 28, 2026 at 00:57, Marek Vasut <marek.vasut+renesas@mailbox.org> wrote:
>
>> Add simple test for zip/unzip/gzwrite commands. The test works as
>> follows. First, create three buffers with a bit of space between
>> each of them, fill them with random data, then compress data in
>> buffer 1 into buffer 2, decompress data in buffer 2 either directly
>> into buffer 3 or into MMC 1 and then read them back into buffer 3,
>> and finally compare buffer 1 and buffer 3, they have to be identical.
>>
>> The buffers are filled with random data to detect out of bounds writes.
>> Test for various sizes, both small and large and unaligned.
>>
>> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
>
> I've tested this with
>
> $ ./test/py/test.py --bd sandbox --build -k ut
>
> Followed by:
>
> $ ./test/py/test.py --bd sandbox --build -k cmd_zip
>
> And I see:
>
> FAILED test/py/tests/test_ut.py::test_ut[ut_dm_dm_test_cmd_zip_gzwrite] - ValueError: U-Boot exited with signal 11 (SIGSEGV)
> FAILED test/py/tests/test_ut.py::test_ut[ut_dm_dm_test_cmd_zip_unzip] - ValueError: U-Boot exited with signal 11 (SIGSEGV)
You will also need these four fixes, then it should work:
cmd: zip: Add missing unmap_sysmem() for buffers in the unzip command
cmd: zip: Use map_sysmem() with buffers in the zip command
cmd: unzip: Use map_sysmem() with buffers in the gzwrite command
gunzip: Fix len parameter in function signature
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/3] gunzip: Add ability to disable progress indicator
2026-01-29 16:17 ` [PATCH 1/3] gunzip: Add ability to disable progress indicator Mattijs Korpershoek
@ 2026-01-29 16:33 ` Marek Vasut
2026-01-29 16:53 ` Tom Rini
2026-01-29 19:21 ` Mattijs Korpershoek
0 siblings, 2 replies; 15+ messages in thread
From: Marek Vasut @ 2026-01-29 16:33 UTC (permalink / raw)
To: Mattijs Korpershoek, u-boot
Cc: Alexander Graf, Heinrich Schuchardt, Ilias Apalodimas,
Jerome Forissier, Neil Armstrong, Peng Fan, Quentin Schulz,
Simon Glass, Tom Rini, Yuya Hamamachi
On 1/29/26 5:17 PM, Mattijs Korpershoek wrote:
Hi,
> +++ b/lib/gunzip.c
> @@ -8,6 +8,7 @@
> #include <command.h>
> #include <console.h>
> #include <div64.h>
> +#include <env.h>
> #include <gzip.h>
> #include <image.h>
> #include <malloc.h>
This is part of
gunzip: Implement chunked decompression
so clearly I should move that part here already.
> Maybe this should be included conditionally depending on the command
> being enabled or not?
Why conditionally ?
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/3] gunzip: Add ability to disable progress indicator
2026-01-29 16:33 ` Marek Vasut
@ 2026-01-29 16:53 ` Tom Rini
2026-01-29 16:57 ` Marek Vasut
2026-01-29 19:21 ` Mattijs Korpershoek
1 sibling, 1 reply; 15+ messages in thread
From: Tom Rini @ 2026-01-29 16:53 UTC (permalink / raw)
To: Marek Vasut
Cc: Mattijs Korpershoek, u-boot, Alexander Graf, Heinrich Schuchardt,
Ilias Apalodimas, Jerome Forissier, Neil Armstrong, Peng Fan,
Quentin Schulz, Simon Glass, Yuya Hamamachi
[-- Attachment #1: Type: text/plain, Size: 709 bytes --]
On Thu, Jan 29, 2026 at 05:33:45PM +0100, Marek Vasut wrote:
> On 1/29/26 5:17 PM, Mattijs Korpershoek wrote:
>
> Hi,
>
> > +++ b/lib/gunzip.c
> > @@ -8,6 +8,7 @@
> > #include <command.h>
> > #include <console.h>
> > #include <div64.h>
> > +#include <env.h>
> > #include <gzip.h>
> > #include <image.h>
> > #include <malloc.h>
>
> This is part of
>
> gunzip: Implement chunked decompression
>
> so clearly I should move that part here already.
>
> > Maybe this should be included conditionally depending on the command
> > being enabled or not?
> Why conditionally ?
A good general question I had is, what's the overall size impact of
these features?
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/3] gunzip: Add ability to disable progress indicator
2026-01-29 16:53 ` Tom Rini
@ 2026-01-29 16:57 ` Marek Vasut
2026-01-29 17:16 ` Tom Rini
0 siblings, 1 reply; 15+ messages in thread
From: Marek Vasut @ 2026-01-29 16:57 UTC (permalink / raw)
To: Tom Rini
Cc: Mattijs Korpershoek, u-boot, Alexander Graf, Heinrich Schuchardt,
Ilias Apalodimas, Jerome Forissier, Neil Armstrong, Peng Fan,
Quentin Schulz, Simon Glass, Yuya Hamamachi
On 1/29/26 5:53 PM, Tom Rini wrote:
> On Thu, Jan 29, 2026 at 05:33:45PM +0100, Marek Vasut wrote:
>> On 1/29/26 5:17 PM, Mattijs Korpershoek wrote:
>>
>> Hi,
>>
>>> +++ b/lib/gunzip.c
>>> @@ -8,6 +8,7 @@
>>> #include <command.h>
>>> #include <console.h>
>>> #include <div64.h>
>>> +#include <env.h>
>>> #include <gzip.h>
>>> #include <image.h>
>>> #include <malloc.h>
>>
>> This is part of
>>
>> gunzip: Implement chunked decompression
>>
>> so clearly I should move that part here already.
>>
>>> Maybe this should be included conditionally depending on the command
>>> being enabled or not?
>> Why conditionally ?
>
> A good general question I had is, what's the overall size impact of
> these features?
A more general question is, can we do without this patch. I think yes,
but I didn't find a way to make the test pass without inhibiting this
odd self-rewriting progress line. Is there a way to ignore output until
specific line shows up or something along those lines ?
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/3] gunzip: Add ability to disable progress indicator
2026-01-29 16:57 ` Marek Vasut
@ 2026-01-29 17:16 ` Tom Rini
2026-01-29 17:25 ` Marek Vasut
0 siblings, 1 reply; 15+ messages in thread
From: Tom Rini @ 2026-01-29 17:16 UTC (permalink / raw)
To: Marek Vasut
Cc: Mattijs Korpershoek, u-boot, Alexander Graf, Heinrich Schuchardt,
Ilias Apalodimas, Jerome Forissier, Neil Armstrong, Peng Fan,
Quentin Schulz, Simon Glass, Yuya Hamamachi
[-- Attachment #1: Type: text/plain, Size: 1251 bytes --]
On Thu, Jan 29, 2026 at 05:57:47PM +0100, Marek Vasut wrote:
> On 1/29/26 5:53 PM, Tom Rini wrote:
> > On Thu, Jan 29, 2026 at 05:33:45PM +0100, Marek Vasut wrote:
> > > On 1/29/26 5:17 PM, Mattijs Korpershoek wrote:
> > >
> > > Hi,
> > >
> > > > +++ b/lib/gunzip.c
> > > > @@ -8,6 +8,7 @@
> > > > #include <command.h>
> > > > #include <console.h>
> > > > #include <div64.h>
> > > > +#include <env.h>
> > > > #include <gzip.h>
> > > > #include <image.h>
> > > > #include <malloc.h>
> > >
> > > This is part of
> > >
> > > gunzip: Implement chunked decompression
> > >
> > > so clearly I should move that part here already.
> > >
> > > > Maybe this should be included conditionally depending on the command
> > > > being enabled or not?
> > > Why conditionally ?
> >
> > A good general question I had is, what's the overall size impact of
> > these features?
> A more general question is, can we do without this patch. I think yes, but I
> didn't find a way to make the test pass without inhibiting this odd
> self-rewriting progress line. Is there a way to ignore output until specific
> line shows up or something along those lines ?
I believe so, but I don't recall off-hand.
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/3] gunzip: Add ability to disable progress indicator
2026-01-29 17:16 ` Tom Rini
@ 2026-01-29 17:25 ` Marek Vasut
0 siblings, 0 replies; 15+ messages in thread
From: Marek Vasut @ 2026-01-29 17:25 UTC (permalink / raw)
To: Tom Rini
Cc: Mattijs Korpershoek, u-boot, Alexander Graf, Heinrich Schuchardt,
Ilias Apalodimas, Jerome Forissier, Neil Armstrong, Peng Fan,
Quentin Schulz, Simon Glass, Yuya Hamamachi
On 1/29/26 6:16 PM, Tom Rini wrote:
> On Thu, Jan 29, 2026 at 05:57:47PM +0100, Marek Vasut wrote:
>> On 1/29/26 5:53 PM, Tom Rini wrote:
>>> On Thu, Jan 29, 2026 at 05:33:45PM +0100, Marek Vasut wrote:
>>>> On 1/29/26 5:17 PM, Mattijs Korpershoek wrote:
>>>>
>>>> Hi,
>>>>
>>>>> +++ b/lib/gunzip.c
>>>>> @@ -8,6 +8,7 @@
>>>>> #include <command.h>
>>>>> #include <console.h>
>>>>> #include <div64.h>
>>>>> +#include <env.h>
>>>>> #include <gzip.h>
>>>>> #include <image.h>
>>>>> #include <malloc.h>
>>>>
>>>> This is part of
>>>>
>>>> gunzip: Implement chunked decompression
>>>>
>>>> so clearly I should move that part here already.
>>>>
>>>>> Maybe this should be included conditionally depending on the command
>>>>> being enabled or not?
>>>> Why conditionally ?
>>>
>>> A good general question I had is, what's the overall size impact of
>>> these features?
>> A more general question is, can we do without this patch. I think yes, but I
>> didn't find a way to make the test pass without inhibiting this odd
>> self-rewriting progress line. Is there a way to ignore output until specific
>> line shows up or something along those lines ?
>
> I believe so, but I don't recall off-hand.
Nevermind, I found a way, it is ugly looking but works, I'll send V2
without this patch.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/3] gunzip: Add ability to disable progress indicator
2026-01-29 16:33 ` Marek Vasut
2026-01-29 16:53 ` Tom Rini
@ 2026-01-29 19:21 ` Mattijs Korpershoek
1 sibling, 0 replies; 15+ messages in thread
From: Mattijs Korpershoek @ 2026-01-29 19:21 UTC (permalink / raw)
To: Marek Vasut, Mattijs Korpershoek, u-boot
Cc: Alexander Graf, Heinrich Schuchardt, Ilias Apalodimas,
Jerome Forissier, Neil Armstrong, Peng Fan, Quentin Schulz,
Simon Glass, Tom Rini, Yuya Hamamachi
On Thu, Jan 29, 2026 at 17:33, Marek Vasut <marek.vasut@mailbox.org> wrote:
> On 1/29/26 5:17 PM, Mattijs Korpershoek wrote:
>
> Hi,
>
>> +++ b/lib/gunzip.c
>> @@ -8,6 +8,7 @@
>> #include <command.h>
>> #include <console.h>
>> #include <div64.h>
>> +#include <env.h>
>> #include <gzip.h>
>> #include <image.h>
>> #include <malloc.h>
>
> This is part of
>
> gunzip: Implement chunked decompression
>
> so clearly I should move that part here already.
>
>> Maybe this should be included conditionally depending on the command
>> being enabled or not?
> Why conditionally ?
Tom seems to have chimed in already but code size was one of them.
Other reason was that it seems weird to have library code (that should
not have too many dependencies) depend on environment (which is
optional).
Especially if it's just for test cases.
I see from the thread that this will be dropped for v2 so no longer need
to debate about this :)
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 3/3] test: cmd: Add test for zip/unzip/gzwrite commands
2026-01-29 16:31 ` Marek Vasut
@ 2026-01-29 19:34 ` Mattijs Korpershoek
2026-01-29 19:43 ` Marek Vasut
0 siblings, 1 reply; 15+ messages in thread
From: Mattijs Korpershoek @ 2026-01-29 19:34 UTC (permalink / raw)
To: Marek Vasut, Mattijs Korpershoek, u-boot
Cc: Alexander Graf, Heinrich Schuchardt, Ilias Apalodimas,
Jerome Forissier, Neil Armstrong, Peng Fan, Quentin Schulz,
Simon Glass, Tom Rini, Yuya Hamamachi
On Thu, Jan 29, 2026 at 17:31, Marek Vasut <marek.vasut@mailbox.org> wrote:
> On 1/29/26 5:26 PM, Mattijs Korpershoek wrote:
>
> Hi,
>
>> On Wed, Jan 28, 2026 at 00:57, Marek Vasut <marek.vasut+renesas@mailbox.org> wrote:
>>
>>> Add simple test for zip/unzip/gzwrite commands. The test works as
>>> follows. First, create three buffers with a bit of space between
>>> each of them, fill them with random data, then compress data in
>>> buffer 1 into buffer 2, decompress data in buffer 2 either directly
>>> into buffer 3 or into MMC 1 and then read them back into buffer 3,
>>> and finally compare buffer 1 and buffer 3, they have to be identical.
>>>
>>> The buffers are filled with random data to detect out of bounds writes.
>>> Test for various sizes, both small and large and unaligned.
>>>
>>> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
>>
>> I've tested this with
>>
>> $ ./test/py/test.py --bd sandbox --build -k ut
>>
>> Followed by:
>>
>> $ ./test/py/test.py --bd sandbox --build -k cmd_zip
>>
>> And I see:
>>
>> FAILED test/py/tests/test_ut.py::test_ut[ut_dm_dm_test_cmd_zip_gzwrite] - ValueError: U-Boot exited with signal 11 (SIGSEGV)
>> FAILED test/py/tests/test_ut.py::test_ut[ut_dm_dm_test_cmd_zip_unzip] - ValueError: U-Boot exited with signal 11 (SIGSEGV)
> You will also need these four fixes, then it should work:
>
> cmd: zip: Add missing unmap_sysmem() for buffers in the unzip command
> cmd: zip: Use map_sysmem() with buffers in the zip command
> cmd: unzip: Use map_sysmem() with buffers in the gzwrite command
> gunzip: Fix len parameter in function signature
Indeed, when these four fixes are applied first, the tests pass:
test/py/tests/test_ut.py .. [100%]
============================================================================================================================================= 2 passed, 1464 deselected in 1.41
Can you mark these patches as dependencies of this series for v2?
Thanks
Mattijs
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 3/3] test: cmd: Add test for zip/unzip/gzwrite commands
2026-01-29 19:34 ` Mattijs Korpershoek
@ 2026-01-29 19:43 ` Marek Vasut
0 siblings, 0 replies; 15+ messages in thread
From: Marek Vasut @ 2026-01-29 19:43 UTC (permalink / raw)
To: Mattijs Korpershoek, u-boot
Cc: Alexander Graf, Heinrich Schuchardt, Ilias Apalodimas,
Jerome Forissier, Neil Armstrong, Peng Fan, Quentin Schulz,
Simon Glass, Tom Rini, Yuya Hamamachi
On 1/29/26 8:34 PM, Mattijs Korpershoek wrote:
> On Thu, Jan 29, 2026 at 17:31, Marek Vasut <marek.vasut@mailbox.org> wrote:
>
>> On 1/29/26 5:26 PM, Mattijs Korpershoek wrote:
>>
>> Hi,
>>
>>> On Wed, Jan 28, 2026 at 00:57, Marek Vasut <marek.vasut+renesas@mailbox.org> wrote:
>>>
>>>> Add simple test for zip/unzip/gzwrite commands. The test works as
>>>> follows. First, create three buffers with a bit of space between
>>>> each of them, fill them with random data, then compress data in
>>>> buffer 1 into buffer 2, decompress data in buffer 2 either directly
>>>> into buffer 3 or into MMC 1 and then read them back into buffer 3,
>>>> and finally compare buffer 1 and buffer 3, they have to be identical.
>>>>
>>>> The buffers are filled with random data to detect out of bounds writes.
>>>> Test for various sizes, both small and large and unaligned.
>>>>
>>>> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
>>>
>>> I've tested this with
>>>
>>> $ ./test/py/test.py --bd sandbox --build -k ut
>>>
>>> Followed by:
>>>
>>> $ ./test/py/test.py --bd sandbox --build -k cmd_zip
>>>
>>> And I see:
>>>
>>> FAILED test/py/tests/test_ut.py::test_ut[ut_dm_dm_test_cmd_zip_gzwrite] - ValueError: U-Boot exited with signal 11 (SIGSEGV)
>>> FAILED test/py/tests/test_ut.py::test_ut[ut_dm_dm_test_cmd_zip_unzip] - ValueError: U-Boot exited with signal 11 (SIGSEGV)
>> You will also need these four fixes, then it should work:
>>
>> cmd: zip: Add missing unmap_sysmem() for buffers in the unzip command
>> cmd: zip: Use map_sysmem() with buffers in the zip command
>> cmd: unzip: Use map_sysmem() with buffers in the gzwrite command
>> gunzip: Fix len parameter in function signature
>
> Indeed, when these four fixes are applied first, the tests pass:
>
> test/py/tests/test_ut.py .. [100%]
>
> ============================================================================================================================================= 2 passed, 1464 deselected in 1.41
>
> Can you mark these patches as dependencies of this series for v2?
Already did :)
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2026-01-29 19:43 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-27 23:57 [PATCH 1/3] gunzip: Add ability to disable progress indicator Marek Vasut
2026-01-27 23:57 ` [PATCH 2/3] configs: sandbox: Enable zip command Marek Vasut
2026-01-29 16:17 ` Mattijs Korpershoek
2026-01-27 23:57 ` [PATCH 3/3] test: cmd: Add test for zip/unzip/gzwrite commands Marek Vasut
2026-01-29 16:26 ` Mattijs Korpershoek
2026-01-29 16:31 ` Marek Vasut
2026-01-29 19:34 ` Mattijs Korpershoek
2026-01-29 19:43 ` Marek Vasut
2026-01-29 16:17 ` [PATCH 1/3] gunzip: Add ability to disable progress indicator Mattijs Korpershoek
2026-01-29 16:33 ` Marek Vasut
2026-01-29 16:53 ` Tom Rini
2026-01-29 16:57 ` Marek Vasut
2026-01-29 17:16 ` Tom Rini
2026-01-29 17:25 ` Marek Vasut
2026-01-29 19:21 ` Mattijs Korpershoek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox