[PATCH v2 06/20] command_ut: test: Move test into lib

Simon Glass sjg at chromium.org
Fri Nov 15 15:27:07 CET 2024


Hi Heinrich,

On Thu, 14 Nov 2024 at 04:09, Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
>
> On 11/2/24 20:36, Simon Glass wrote:
> > This test doesn't belong at the top level. Move it into the lib/
> > directory, since that is where compression is implemented.
> >
> > Rename it to just 'command', since it is obviously a unit test and the
> > _ut suffix does not add much except to make it different from the names
> > of other test files.
> >
> > Signed-off-by: Simon Glass <sjg at chromium.org>
> > ---
> >
> > (no changes since v1)
> >
> >   test/Makefile                        | 1 -
> >   test/cmd/Makefile                    | 1 +
> >   test/{command_ut.c => cmd/command.c} | 0
> >   3 files changed, 1 insertion(+), 1 deletion(-)
> >   rename test/{command_ut.c => cmd/command.c} (100%)
> >
> > diff --git a/test/Makefile b/test/Makefile
> > index ff621344a03..48d8bc91ae6 100644
> > --- a/test/Makefile
> > +++ b/test/Makefile
> > @@ -9,7 +9,6 @@ obj-$(CONFIG_$(XPL_)CMDLINE) += bootm.o
> >   endif
> >   obj-$(CONFIG_$(XPL_)CMDLINE) += cmd/
> >   obj-$(CONFIG_$(XPL_)CMDLINE) += cmd_ut.o
> > -obj-$(CONFIG_$(XPL_)CMDLINE) += command_ut.o
> >   obj-y += dm/
> >   obj-$(CONFIG_FUZZ) += fuzz/
> >   ifndef CONFIG_SANDBOX_VPL
> > diff --git a/test/cmd/Makefile b/test/cmd/Makefile
> > index fe7a2165af2..6231a08186d 100644
> > --- a/test/cmd/Makefile
> > +++ b/test/cmd/Makefile
> > @@ -5,6 +5,7 @@
> >
> >   obj-y += cmd_ut_cmd.o
> >
> > +obj-$(CONFIG_$(XPL_)CMDLINE) += command.o
> >   ifdef CONFIG_HUSH_PARSER
> >   obj-$(CONFIG_CONSOLE_RECORD) += test_echo.o
> >   endif
> > diff --git a/test/command_ut.c b/test/cmd/command.c
> > similarity index 100%
> > rename from test/command_ut.c
> > rename to test/cmd/command.c
>
> There are CLI variables using env and others that don't.
> The latter we seem not to be tested.
>
> Maybe we can add a test like the following after your series is merged.
>
> => a=123
> => env set b 456
> => echo $a$b
> 123456
> => env print b
> b=456
> => env print a
> ## Error: "a" not defined
> =>
>
> Reviewed-by: Heinrich Schuchardt <xypron.glpk at gmx.de>

Hmm yes, that would be useful. See also test/hush/dollar.c for
example, which has some related tests, but not quite the same.

Regards,
Simon


More information about the U-Boot mailing list