diff mbox series

[v11,05/29] test: boot: fix bootdev_test_any for when DSA_SANDBOX is disabled

Message ID ec9e9d1eff4404d2615e825d2f35af0720c29a92.1727968902.git.jerome.forissier@linaro.org
State Superseded
Headers show
Series Introduce the lwIP network stack | expand

Commit Message

Jerome Forissier Oct. 3, 2024, 3:22 p.m. UTC
When DSA_SANDBOX is not set, the sandbox tests fail as follows:

 $ ./test/py/test.py --build-dir=$(pwd) -k bootdev_test_any
 [...]
 Test: bootdev_test_any: bootdev.c
 test/boot/bootdev.c:156, bootdev_test_any(): "mmc2" = media->name: Expected "mmc2", got "mmc0"
 [...]

This is due to the device list containing two less entries than
expected. Therefore, adjust the expected index to be two less when
DSA_SANDBOX is disabled.

The actual use case is NET_LWIP=y (to be introduced in later patches)
which implies DSA_SANDBOX=n for the time being.

Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
---
 test/boot/bootdev.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

Comments

Simon Glass Oct. 9, 2024, 1:51 a.m. UTC | #1
On Thu, 3 Oct 2024 at 09:23, Jerome Forissier
<jerome.forissier@linaro.org> wrote:
>
> When DSA_SANDBOX is not set, the sandbox tests fail as follows:
>
>  $ ./test/py/test.py --build-dir=$(pwd) -k bootdev_test_any
>  [...]
>  Test: bootdev_test_any: bootdev.c
>  test/boot/bootdev.c:156, bootdev_test_any(): "mmc2" = media->name: Expected "mmc2", got "mmc0"
>  [...]
>
> This is due to the device list containing two less entries than
> expected. Therefore, adjust the expected index to be two less when
> DSA_SANDBOX is disabled.
>
> The actual use case is NET_LWIP=y (to be introduced in later patches)
> which implies DSA_SANDBOX=n for the time being.
>
> Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
> ---
>  test/boot/bootdev.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
>

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


> diff --git a/test/boot/bootdev.c b/test/boot/bootdev.c
> index c635d06ec25..369105ca4cf 100644
> --- a/test/boot/bootdev.c
> +++ b/test/boot/bootdev.c
> @@ -128,6 +128,7 @@ BOOTSTD_TEST(bootdev_test_labels, UTF_DM | UTF_SCAN_FDT | UTF_ETH_BOOTDEV);
>  static int bootdev_test_any(struct unit_test_state *uts)
>  {
>         struct udevice *dev, *media;
> +       char *seq;
>         int mflags;
>
>         /*
> @@ -147,8 +148,16 @@ static int bootdev_test_any(struct unit_test_state *uts)
>          * 8   [   ]      OK  mmc       mmc2.bootdev
>          * 9   [ + ]      OK  mmc       mmc1.bootdev
>          * a   [   ]      OK  mmc       mmc0.bootdev
> +        *
> +        * However if DSA_SANDBOX is disabled the dsa-test@{0,1} devices
> +        * are not there.
>          */
> -       ut_assertok(bootdev_find_by_any("8", &dev, &mflags));
> +       if (CONFIG_IS_ENABLED(DSA_SANDBOX))
> +               seq = "8";
> +       else
> +               seq = "6";
> +
> +       ut_assertok(bootdev_find_by_any(seq, &dev, &mflags));
>         ut_asserteq(UCLASS_BOOTDEV, device_get_uclass_id(dev));
>         ut_asserteq(BOOTFLOW_METHF_SINGLE_DEV, mflags);
>         media = dev_get_parent(dev);
> --
> 2.40.1
>
diff mbox series

Patch

diff --git a/test/boot/bootdev.c b/test/boot/bootdev.c
index c635d06ec25..369105ca4cf 100644
--- a/test/boot/bootdev.c
+++ b/test/boot/bootdev.c
@@ -128,6 +128,7 @@  BOOTSTD_TEST(bootdev_test_labels, UTF_DM | UTF_SCAN_FDT | UTF_ETH_BOOTDEV);
 static int bootdev_test_any(struct unit_test_state *uts)
 {
 	struct udevice *dev, *media;
+	char *seq;
 	int mflags;
 
 	/*
@@ -147,8 +148,16 @@  static int bootdev_test_any(struct unit_test_state *uts)
 	 * 8   [   ]      OK  mmc       mmc2.bootdev
 	 * 9   [ + ]      OK  mmc       mmc1.bootdev
 	 * a   [   ]      OK  mmc       mmc0.bootdev
+	 *
+	 * However if DSA_SANDBOX is disabled the dsa-test@{0,1} devices
+	 * are not there.
 	 */
-	ut_assertok(bootdev_find_by_any("8", &dev, &mflags));
+	if (CONFIG_IS_ENABLED(DSA_SANDBOX))
+		seq = "8";
+	else
+		seq = "6";
+
+	ut_assertok(bootdev_find_by_any(seq, &dev, &mflags));
 	ut_asserteq(UCLASS_BOOTDEV, device_get_uclass_id(dev));
 	ut_asserteq(BOOTFLOW_METHF_SINGLE_DEV, mflags);
 	media = dev_get_parent(dev);