[U-Boot] [PATCH v2 4/4] test: dm: spi: Fix sandbox dm_test_spi_find()

Jagan Teki jagan at amarulasolutions.com
Wed Oct 16 14:07:09 UTC 2019


On Mon, Sep 9, 2019 at 6:30 PM Bin Meng <bmeng.cn at gmail.com> wrote:
>
> Per sandbox_cs_info(), sandbox spi controller only supports chip
> select 0. Current test case tries to locate devices on chip select
> 1, and any call to spi_get_bus_and_cs() or spi_cs_info() with cs
> number 1 should not return 0.
>
> This updates the test case to handle it correctly.
>
> Signed-off-by: Bin Meng <bmeng.cn at gmail.com>
>
> ---
>
> Changes in v2:
> - new patch to fix sandbox dm_test_spi_find()
>
>  test/dm/spi.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/test/dm/spi.c b/test/dm/spi.c
> index ffd789c..8e417ac 100644
> --- a/test/dm/spi.c
> +++ b/test/dm/spi.c
> @@ -77,10 +77,10 @@ static int dm_test_spi_find(struct unit_test_state *uts)
>         /* We should be able to add something to another chip select */
>         ut_assertok(sandbox_sf_bind_emul(state, busnum, cs_b, bus, node,
>                                          "name"));
> -       ut_assertok(spi_get_bus_and_cs(busnum, cs_b, speed, mode,
> +       ut_asserteq(-EINVAL, spi_get_bus_and_cs(busnum, cs_b, speed, mode,
>                                        "spi_flash_std", "name", &bus, &slave));
> -       ut_assertok(spi_cs_info(bus, cs_b, &info));
> -       ut_asserteq_ptr(info.dev, slave->dev);
> +       ut_asserteq(-EINVAL, spi_cs_info(bus, cs_b, &info));
> +       ut_asserteq_ptr(NULL, info.dev);

I assume you ran the sandbox test for this, if yes

Reviewed-by: Jagan Teki <jagan at amarulasolutions.com>


More information about the U-Boot mailing list