From: Francis Laniel <francis.laniel@amarulasolutions.com>
To: Tom Rini <trini@konsulko.com>, Simon Glass <sjg@chromium.org>
Cc: u-boot@lists.denx.de,
Michael Nazzareno Trimarchi <michael@amarulasolutions.com>,
Harald Seiler <hws@denx.de>,
Evgeny Bachinin <EABachinin@sberdevices.ru>,
Marek Vasut <marex@denx.de>,
Hector Palacios <hector.palacios@digi.com>
Subject: Re: [PATCH v13 15/24] cli: add modern hush as parser for run_command*()
Date: Fri, 29 Dec 2023 19:55:04 +0100 [thread overview]
Message-ID: <2712762.mvXUDI8C0e@pwmachine> (raw)
In-Reply-To: <CAFLszTi_S4Q+=i-1=-UjBN7RWUOSC+FF1B3p8z7rU8spMh2YXQ@mail.gmail.com>
Hi!
Le mardi 26 décembre 2023, 10:46:48 CET Simon Glass a écrit :
> Hi,
>
> On Fri, Dec 22, 2023 at 9:23 PM Tom Rini <trini@konsulko.com> wrote:
> > On Fri, Dec 22, 2023 at 10:10:42PM +0100, Francis Laniel wrote:
> > > Hi!
> > >
> > > Le vendredi 22 décembre 2023, 22:02:35 CET Francis Laniel a écrit :
> > > > Enables using, in code, modern hush as parser for run_command function
> > > > family. It also enables the command run to be used by CLI user of
> > > > modern
> > > > hush.
> > > >
> > > > Reviewed-by: Simon Glass <sjg@chromium.org>
> > > > Signed-off-by: Francis Laniel <francis.laniel@amarulasolutions.com>
> >
> > [snip]
> >
> > > > diff --git a/test/boot/bootflow.c b/test/boot/bootflow.c
> > > > index a9b555c779..104f49deef 100644
> > > > --- a/test/boot/bootflow.c
> > > > +++ b/test/boot/bootflow.c
> > > > @@ -710,7 +710,21 @@ static int bootflow_scan_menu_boot(struct
> > > > unit_test_state *uts) ut_assert_skip_to_line("(2 bootflows, 2
> > > > valid)");
> > > >
> > > > ut_assert_nextline("Selected: Armbian");
> > > >
> > > > - ut_assert_skip_to_line("Boot failed (err=-14)");
> > > > +
> > > > + if (gd->flags & GD_FLG_HUSH_OLD_PARSER) {
> > > > + /*
> > > > + * With old hush, despite booti failing to boot, i.e.
> > > > returning
> > > > + * CMD_RET_FAILURE, run_command() returns 0 which leads
> > >
> > > bootflow_boot(),
> > >
> > > > as + * we are using bootmeth_script here, to return
> > > > -EFAULT. + */
> > > > + ut_assert_skip_to_line("Boot failed (err=-14)");
> > > > + } else if (gd->flags & GD_FLG_HUSH_MODERN_PARSER) {
> > > > + /*
> > > > + * While with modern one, run_command() propagates
> > >
> > > CMD_RET_FAILURE
> > >
> > > > returned + * by booti, so we get 1 here.
> > > > + */
> > > > + ut_assert_skip_to_line("Boot failed (err=1)");
> > > > + }
> > >
> > > I would like to give a bit of context here.
> > > With the following patch:
> > > diff --git a/test/py/tests/test_ut.py b/test/py/tests/test_ut.py
> > > index c169c835e3..cc5adda0a3 100644
> > > --- a/test/py/tests/test_ut.py
> > > +++ b/test/py/tests/test_ut.py
> > > @@ -173,7 +173,7 @@ else
> > >
> > > fi
> > >
> > > fi
> > > booti ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r}
> > >
> > > -
> > > +echo $?
> > >
> > > # Recompile with:
> > > # mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr
> > > ''' % (mmc_dev)
> > >
> > > We can easily see that booti is failing while running the test:
> > > $ ./test/py/test.py -o log_cli=true -s --build -v -k
> > > 'test_ut[ut_bootstd_bootflow_scan_menu_boot'
> > > ...
> > > Aborting!
> > > Failed to load '/boot/dtb/rockchip/overlay/-fixup.scr'
> > > 1
> > >
> > > The problem with old hush, is that the 1 returned here, which
> > > corresponds to CMD_RET_FAILURE, is not propagated as the return value
> > > of run_command(). So, this lead the -EFAULT branch here to be taken:
> > > int bootflow_boot(struct bootflow *bflow)
> > > {
> > >
> > > /* ... */
> > >
> > > ret = bootmeth_boot(bflow->method, bflow);
> > > if (ret)
> > >
> > > return log_msg_ret("boot", ret);
> > >
> > > /*
> > >
> > > * internal error, should not get here since we should have booted
> > > * something or returned an error
> > > */
> > >
> > > return log_msg_ret("end", -EFAULT);
> > >
> > > }
> > >
> > > With modern hush, CMD_RET_FAILURE is propagated as the return value of
> > > run_command().
> > > As a consequence, we return with log_mst_ret("boot", 1), which leaded to
> > > this test to fail.
> > > The above modification consists in adapting the expected output to the
> > > current shell flavor.
> > > I think this is the good thing to do, as I find modern hush behavior
> > > better
> > > than the old one, i.e. it propagates CMD_RET_FAILURE as return of
> > > run_command().
> >
> > Oh very nice, thanks for digging in to this and explaining!
>
> Yes, thank you from me too!
You are welcome!
>
> - Simon
Best regards and have a nice end of the year!
next prev parent reply other threads:[~2023-12-29 18:55 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-22 21:02 [PATCH v13 00/24] Modernize U-Boot shell Francis Laniel
2023-12-22 21:02 ` [PATCH v13 01/24] test: Add framework to test hush behavior Francis Laniel
2023-12-22 21:02 ` [PATCH v13 02/24] test: hush: Test hush if/else Francis Laniel
2023-12-22 21:02 ` [PATCH v13 03/24] test/py: hush_if_test: Remove the test file Francis Laniel
2023-12-22 21:02 ` [PATCH v13 04/24] test: hush: Test hush variable expansion Francis Laniel
2023-12-22 21:02 ` [PATCH v13 05/24] test: hush: Test hush commands list Francis Laniel
2023-12-22 21:02 ` [PATCH v13 06/24] test: hush: Test hush loops Francis Laniel
2023-12-22 21:02 ` [PATCH v13 07/24] cli: Add Busybox upstream hush.c file Francis Laniel
2023-12-22 21:02 ` [PATCH v13 08/24] cli: Port upstream Busybox hush to U-Boot Francis Laniel
2023-12-22 21:02 ` [PATCH v13 09/24] cli: Add menu for hush parser Francis Laniel
2023-12-22 21:02 ` [PATCH v13 10/24] global_data.h: add GD_FLG_HUSH_OLD_PARSER flag Francis Laniel
2023-12-22 21:02 ` [PATCH v13 11/24] cmd: Add new cli command Francis Laniel
2023-12-22 21:02 ` [PATCH v13 12/24] cli: Enables using modern hush parser as command line parser Francis Laniel
2023-12-22 21:02 ` [PATCH v13 13/24] cli: hush_modern: Enable variables expansion for modern hush Francis Laniel
2023-12-22 21:02 ` [PATCH v13 14/24] cli: hush_modern: Add functions to be called from run_command() Francis Laniel
2023-12-22 21:02 ` [PATCH v13 15/24] cli: add modern hush as parser for run_command*() Francis Laniel
2023-12-22 21:10 ` Francis Laniel
2023-12-22 21:23 ` Tom Rini
2023-12-26 9:46 ` Simon Glass
2023-12-29 18:55 ` Francis Laniel [this message]
2023-12-22 21:02 ` [PATCH v13 16/24] test: hush: Fix instructions list tests for modern hush Francis Laniel
2023-12-22 21:02 ` [PATCH v13 17/24] test: hush: Fix variable expansion " Francis Laniel
2023-12-22 21:02 ` [PATCH v13 18/24] cli: hush_modern: Enable using < and > as string compare operators Francis Laniel
2023-12-22 21:02 ` [PATCH v13 19/24] cli: hush_modern: Enable if keyword Francis Laniel
2023-12-22 21:02 ` [PATCH v13 20/24] cli: hush_modern: Enable loops Francis Laniel
2023-12-22 21:02 ` [PATCH v13 21/24] test: hush: Fix loop tests for modern hush Francis Laniel
2023-12-22 21:02 ` [PATCH v13 22/24] cli: modern_hush: Add upstream commits up to 2nd October 2023 Francis Laniel
2023-12-22 21:02 ` [PATCH v13 23/24] cmd: Set modern hush as default shell Francis Laniel
2023-12-22 21:02 ` [PATCH v13 24/24] configs: Use old hush for several boards Francis Laniel
2023-12-28 20:58 ` [PATCH v13 00/24] Modernize U-Boot shell Tom Rini
2023-12-29 18:55 ` Francis Laniel
2024-01-11 17:04 ` Francesco Dolcini
2024-01-15 17:34 ` Patrice CHOTARD
2024-01-16 0:46 ` Tom Rini
2024-01-16 7:08 ` Patrice CHOTARD
2024-01-16 17:25 ` Francis Laniel
2024-01-17 10:05 ` Patrice CHOTARD
2024-01-17 17:30 ` Francis Laniel
2024-01-17 17:39 ` Francesco Dolcini
2024-01-18 7:05 ` Patrice CHOTARD
2024-01-18 14:09 ` Tom Rini
2024-01-16 17:20 ` Francis Laniel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2712762.mvXUDI8C0e@pwmachine \
--to=francis.laniel@amarulasolutions.com \
--cc=EABachinin@sberdevices.ru \
--cc=hector.palacios@digi.com \
--cc=hws@denx.de \
--cc=marex@denx.de \
--cc=michael@amarulasolutions.com \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox