U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mattijs Korpershoek <mkorpershoek@baylibre.com>
To: Svyatoslav Ryhel <clamor95@gmail.com>,
	Tom Rini <trini@konsulko.com>, Simon Glass <sjg@chromium.org>,
	Lukasz Majewski <lukma@denx.de>, Marek Vasut <marex@denx.de>,
	Joe Hershberger <joe.hershberger@ni.com>,
	Ramon Fried <rfried.dev@gmail.com>, Bin Meng <bmeng@tinylab.org>,
	Ion Agorria <ion@agorria.com>,
	Svyatoslav Ryhel <clamor95@gmail.com>,
	Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Harald Seiler <hws@denx.de>,
	Sean Anderson <sean.anderson@seco.com>,
	Heiko Schocher <hs@denx.de>,
	Dmitrii Merkurev <dimorinny@google.com>,
	Patrick Delaunay <patrick.delaunay@foss.st.com>,
	Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
Cc: u-boot@lists.denx.de
Subject: Re: [PATCH v7 7/7] test: hush: dollar: fix bagous behavior
Date: Tue, 09 Jan 2024 14:54:32 +0100	[thread overview]
Message-ID: <87le8ywr1j.fsf@baylibre.com> (raw)
In-Reply-To: <20240105072212.6615-8-clamor95@gmail.com>

Hi Svyatoslav,

Thank you for the patch.

On ven., janv. 05, 2024 at 09:22, Svyatoslav Ryhel <clamor95@gmail.com> wrote:

> From: Ion Agorria <ion@agorria.com>
>
> The dollar test was merged with bagous console behavior, and
> instead of fixing it, this behavior was just workarounded.
>
> It seems like without the fix the ut_assert_skipline(); didn't clear
> console and running ut_assert_skipline(); many times would give always
> OK. With
>
> lib: membuff: fix readline not returning line in case of overflow
>
> the line is cleared correctly and next assert fails because now there
> is nothing to clean which is correct if we look the this a bit above
> the failing assert:
>
>     if (gd->flags & GD_FLG_HUSH_MODERN_PARSER) {
>          /*
>           * For some strange reasons, the console is not empty after
>           * running above command.
>           * So, we reset it to not have side effects for other tests.
>           */
>          console_record_reset_enable();
>     } else if (gd->flags & GD_FLG_HUSH_OLD_PARSER) {
>          ut_assert_console_end();
>     }
>
> Which further confirms that tests workaround the old problem and now
> that problem is fixed we can remove the whole if blocks and simply
> place ut_assert_console_end() right after ut_assert_skipline() without
> any conditional and will pass green.
>
> So this part of code goes from:
>     ut_assert_skipline();
>     ut_assert_skipline();
>
>     if (gd->flags & GD_FLG_HUSH_MODERN_PARSER) {
>         /* See above comments. */
>         console_record_reset_enable();
>     } else if (gd->flags & GD_FLG_HUSH_OLD_PARSER) {
>         ut_assert_console_end();
>     }
>
> to become:
>     ut_assert_skipline();
>     ut_assert_console_end();
>
> Same thing should be done with the if block mentioned above that calls
> console_record_reset_enable().
>
> Signed-off-by: Ion Agorria <ion@agorria.com>
> Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>

I confirm this fixes the problem reported in:
https://lore.kernel.org/all/87wmspm9e5.fsf@baylibre.com/

Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

The commit message is a bit long, but I don't mind it staying this way.

Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

> ---
>  test/hush/dollar.c | 23 +++--------------------
>  1 file changed, 3 insertions(+), 20 deletions(-)
>
> diff --git a/test/hush/dollar.c b/test/hush/dollar.c
> index 4caa07c192..68d0874d90 100644
> --- a/test/hush/dollar.c
> +++ b/test/hush/dollar.c
> @@ -53,29 +53,12 @@ static int hush_test_simple_dollar(struct unit_test_state *uts)
>  	ut_asserteq(1, run_command("dollar_foo='bar quux", 0));
>  	/* Next line contains error message */
>  	ut_assert_skipline();
> -
> -	if (gd->flags & GD_FLG_HUSH_MODERN_PARSER) {
> -		/*
> -		 * For some strange reasons, the console is not empty after
> -		 * running above command.
> -		 * So, we reset it to not have side effects for other tests.
> -		 */
> -		console_record_reset_enable();
> -	} else if (gd->flags & GD_FLG_HUSH_OLD_PARSER) {
> -		ut_assert_console_end();
> -	}
> +	ut_assert_console_end();
>  
>  	ut_asserteq(1, run_command("dollar_foo=bar quux\"", 0));
> -	/* Two next lines contain error message */
> -	ut_assert_skipline();
> +	/* Next line contains error message */
>  	ut_assert_skipline();
> -
> -	if (gd->flags & GD_FLG_HUSH_MODERN_PARSER) {
> -		/* See above comments. */
> -		console_record_reset_enable();
> -	} else if (gd->flags & GD_FLG_HUSH_OLD_PARSER) {
> -		ut_assert_console_end();
> -	}
> +	ut_assert_console_end();
>  
>  	ut_assertok(run_command("dollar_foo='bar \"quux'", 0));
>  
> -- 
> 2.40.1

  reply	other threads:[~2024-01-09 13:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-05  7:22 [PATCH v7 0/7] Implement fastboot multiresponce Svyatoslav Ryhel
2024-01-05  7:22 ` [PATCH v7 1/7] fastboot: multiresponse support Svyatoslav Ryhel
2024-01-05  7:22 ` [PATCH v7 2/7] fastboot: implement "getvar all" Svyatoslav Ryhel
2024-01-05  7:22 ` [PATCH v7 3/7] common: console: introduce console_record_isempty helper Svyatoslav Ryhel
2024-01-05  7:22 ` [PATCH v7 4/7] common: console: record console from the beginning Svyatoslav Ryhel
2024-01-05  7:22 ` [PATCH v7 5/7] lib: membuff: fix readline not returning line in case of overflow Svyatoslav Ryhel
2024-01-05  7:22 ` [PATCH v7 6/7] fastboot: add oem console command support Svyatoslav Ryhel
2024-01-05  7:22 ` [PATCH v7 7/7] test: hush: dollar: fix bagous behavior Svyatoslav Ryhel
2024-01-09 13:54   ` Mattijs Korpershoek [this message]
2024-01-09 13:57     ` Svyatoslav
2024-01-09 14:31       ` Mattijs Korpershoek
2024-01-09 15:44 ` [PATCH v7 0/7] Implement fastboot multiresponce Mattijs Korpershoek

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=87le8ywr1j.fsf@baylibre.com \
    --to=mkorpershoek@baylibre.com \
    --cc=bmeng@tinylab.org \
    --cc=clamor95@gmail.com \
    --cc=dimorinny@google.com \
    --cc=hs@denx.de \
    --cc=hws@denx.de \
    --cc=ion@agorria.com \
    --cc=joe.hershberger@ni.com \
    --cc=lukma@denx.de \
    --cc=marex@denx.de \
    --cc=matthias.schiffer@ew.tq-group.com \
    --cc=patrick.delaunay@foss.st.com \
    --cc=rfried.dev@gmail.com \
    --cc=sean.anderson@seco.com \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.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