[RFC PATCH v7 04/23] test: hush: Test hush variable expansion

Simon Glass sjg at chromium.org
Sat Apr 1 08:32:10 CEST 2023


Hi Francis,


On Fri, 31 Mar 2023 at 08:48, Francis Laniel
<francis.laniel at amarulasolutions.com> wrote:
>
> Verifies shell variables are replaced by their values.
>
> Signed-off-by: Francis Laniel <francis.laniel at amarulasolutions.com>
> ---
>  test/hush/Makefile       |   1 +
>  test/hush/dollar.c       | 167 +++++++++++++++++++++++++++++++++++++++
>  test/py/tests/test_ut.py |   8 +-
>  3 files changed, 175 insertions(+), 1 deletion(-)
>  create mode 100644 test/hush/dollar.c
>

Reviewed-by: Simon Glass <sjg at chromium.org>

nit below

> diff --git a/test/hush/Makefile b/test/hush/Makefile
> index a3c9ae5106..feb4f71956 100644
> --- a/test/hush/Makefile
> +++ b/test/hush/Makefile
> @@ -5,3 +5,4 @@
>
>  obj-y += cmd_ut_hush.o
>  obj-y += if.o
> +obj-y += dollar.o
> diff --git a/test/hush/dollar.c b/test/hush/dollar.c
> new file mode 100644
> index 0000000000..27feda2970
> --- /dev/null
> +++ b/test/hush/dollar.c
> @@ -0,0 +1,167 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * (C) Copyright 2021
> + * Francis Laniel, Amarula Solutions, francis.laniel at amarulasolutions.com
> + */
> +
> +#include <common.h>
> +#include <command.h>
> +#include <env_attr.h>
> +#include <test/hush.h>
> +#include <test/ut.h>
> +
> +static int hush_test_simple_dollar(struct unit_test_state *uts)
> +{
> +       console_record_reset_enable();
> +       ut_assertok(run_command("echo $dollar_foo", 0));
> +       ut_assert_nextline("%s", "");

ut_assert_nextline_empty();

> +       ut_assert_console_end();
> +
> +       ut_assertok(run_command("echo ${dollar_foo}", 0));
> +       ut_assert_nextline("%s", "");
> +       ut_assert_console_end();
> +

[..]

Regards,
Simon


More information about the U-Boot mailing list