[PATCH v3 3/7] test: cmd: add unit tests for part command
Simon Glass
sjg at chromium.org
Thu Apr 16 20:51:05 CEST 2026
Hi Dario,
On 2026-04-15T18:31:27, Dario Binacchi
<dario.binacchi at amarulasolutions.com> wrote:
> test: cmd: add unit tests for part command
>
> Add unit tests for the 'part' command, specifically for the 'number',
> 'start', and 'size' subcommands.
>
> These tests establish a baseline for the current partition lookup
> functionality by name. This foundation will be used by subsequent
> patches to extend the command, ensuring consistent behavior as new
> features are introduced.
>
> Signed-off-by: Dario Binacchi <dario.binacchi at amarulasolutions.com>
>
> test/cmd/Makefile | 1 +
> test/cmd/part.c | 161 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 162 insertions(+)
> diff --git a/test/cmd/part.c b/test/cmd/part.c
> @@ -0,0 +1,161 @@
> +#include <dm/test.h>
> +#include <env.h>
> +#include <part.h>
> +#include <test/ut.h>
> +#include <vsprintf.h>
Please include <test/cmd.h> and use CMD_TEST() instead of DM_TEST().
This places the tests in the cmd suite rather than the dm suite. See
test/cmd/hash.c for an example.
> diff --git a/test/cmd/part.c b/test/cmd/part.c
> @@ -0,0 +1,161 @@
> +static int dm_test_cmd_part_number(struct unit_test_state *uts)
With the change to CMD_TEST() please rename the test functions
accordingly, e.g. cmd_test_part_number().
Regards,
Simon
More information about the U-Boot
mailing list