]> git.dujemihanovic.xyz Git - u-boot.git/commit
test: hush: dollar: fix bugous behavior
authorIon Agorria <ion@agorria.com>
Tue, 3 Sep 2024 17:09:42 +0000 (19:09 +0200)
committerTom Rini <trini@konsulko.com>
Fri, 13 Sep 2024 19:43:56 +0000 (13:43 -0600)
commit80ef176ac1ea385eefe95828da5cae4be04532f8
tree58d3721773ad86a6558c32a2d18d615979d68e0f
parent675fde825ad6a27f799305a1828477c1980a3e62
test: hush: dollar: fix bugous behavior

The dollar test was merged with bugous console behavior, and
instead of fixing it, this behavior was just workarounded.
This was done to keep compatibility with the existing behavior.

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 e58bafc35fe3 ("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();
    if (gd->flags & GD_FLG_HUSH_OLD_PARSER) {
        ut_assert_skipline();
    }
    ut_assert_console_end();

The if block mentioned above that calls console_record_reset_enable() is
completely removed as fixed by e58bafc35fe3.

[flaniel: adapt second if]

Signed-off-by: Ion Agorria <ion@agorria.com>
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Link: https://lore.kernel.org/r/20240105072212.6615-8-clamor95@gmail.com
[mkorpershoek: reworded commit title]
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
[flaniel: remove console_record_reset_enable() if]
Signed-off-by: Francis Laniel <francis.laniel@amarulasolutions.com>
test/hush/dollar.c