From: Heinrich Schuchardt <xypron.glpk@gmx.de>
To: Simon Glass <sjg@chromium.org>
Cc: Caleb Connolly <caleb.connolly@linaro.org>,
Ilias Apalodimas <ilias.apalodimas@linaro.org>,
Tom Rini <trini@konsulko.com>,
Dan Carpenter <dan.carpenter@linaro.org>,
Marek Vasut <marek.vasut+renesas@mailbox.org>,
U-Boot Mailing List <u-boot@lists.denx.de>
Subject: Re: [PATCH v2 06/39] bootstd: Create a function to reset USB
Date: Wed, 7 Aug 2024 03:56:31 +0200 [thread overview]
Message-ID: <eb48b869-a130-46a0-b35b-22bdb30daa7f@gmx.de> (raw)
In-Reply-To: <20240806125850.2316956-7-sjg@chromium.org>
On 06.08.24 14:58, Simon Glass wrote:
> Set up a function for this, since it needs to be used from multiple test
> files.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
> (no changes since v1)
>
> test/boot/bootdev.c | 19 ++++++-------------
> test/boot/bootstd_common.c | 12 ++++++++++++
> test/boot/bootstd_common.h | 8 ++++++++
> 3 files changed, 26 insertions(+), 13 deletions(-)
>
> diff --git a/test/boot/bootdev.c b/test/boot/bootdev.c
> index 1bf5929c396..de16a51956d 100644
> --- a/test/boot/bootdev.c
> +++ b/test/boot/bootdev.c
> @@ -16,13 +16,6 @@
> #include <test/ut.h>
> #include "bootstd_common.h"
>
> -/* Allow reseting the USB-started flag */
> -#if defined(CONFIG_USB_HOST) || defined(CONFIG_USB_GADGET)
> -extern bool usb_started;
> -#else
> -#include <usb.h>
> -#endif
> -
> /* Check 'bootdev list' command */
> static int bootdev_test_cmd_list(struct unit_test_state *uts)
> {
> @@ -201,7 +194,7 @@ static int bootdev_test_order(struct unit_test_state *uts)
> test_set_skip_delays(true);
>
> /* Start up USB which gives us three additional bootdevs */
> - usb_started = false;
> + bootstd_reset_usb();
> ut_assertok(run_command("usb start", 0));
>
> /*
> @@ -317,7 +310,7 @@ static int bootdev_test_prio(struct unit_test_state *uts)
> test_set_eth_enable(false);
>
> /* Start up USB which gives us three additional bootdevs */
> - usb_started = false;
> + bootstd_reset_usb();
> ut_assertok(run_command("usb start", 0));
>
> ut_assertok(bootstd_test_drop_bootdev_order(uts));
> @@ -357,7 +350,7 @@ static int bootdev_test_hunter(struct unit_test_state *uts)
> {
> struct bootstd_priv *std;
>
> - usb_started = false;
> + bootstd_reset_usb();
> test_set_skip_delays(true);
>
> /* get access to the used hunters */
> @@ -398,7 +391,7 @@ static int bootdev_test_cmd_hunt(struct unit_test_state *uts)
> struct bootstd_priv *std;
>
> test_set_skip_delays(true);
> - usb_started = false;
> + bootstd_reset_usb();
>
> /* get access to the used hunters */
> ut_assertok(bootstd_get_priv(&std));
> @@ -527,7 +520,7 @@ BOOTSTD_TEST(bootdev_test_bootable, UT_TESTF_DM | UT_TESTF_SCAN_FDT);
> /* Check hunting for bootdev of a particular priority */
> static int bootdev_test_hunt_prio(struct unit_test_state *uts)
> {
> - usb_started = false;
> + bootstd_reset_usb();
> test_set_skip_delays(true);
>
> console_record_reset_enable();
> @@ -556,7 +549,7 @@ static int bootdev_test_hunt_label(struct unit_test_state *uts)
> struct bootstd_priv *std;
> int mflags;
>
> - usb_started = false;
> + bootstd_reset_usb();
>
> /* get access to the used hunters */
> ut_assertok(bootstd_get_priv(&std));
> diff --git a/test/boot/bootstd_common.c b/test/boot/bootstd_common.c
> index e50539500a0..ff0aff4bbe7 100644
> --- a/test/boot/bootstd_common.c
> +++ b/test/boot/bootstd_common.c
> @@ -20,6 +20,13 @@
> /* tracks whether bootstd_setup_for_tests() has been run yet */
> bool vbe_setup_done;
>
> +/* Allow resetting the USB-started flag */
> +#if defined(CONFIG_USB_HOST) || defined(CONFIG_USB_GADGET)
> +extern bool usb_started;
> +#else
> +#include <usb.h>
> +#endif
Why can't you always include usb.h which defines usb_started?
Is there a bug in usb.h?
Best regards
Heinrich
> +
> /* set up MMC for VBE tests */
> int bootstd_setup_for_tests(void)
> {
> @@ -88,6 +95,11 @@ int bootstd_test_check_mmc_hunter(struct unit_test_state *uts)
> return 0;
> }
>
> +void bootstd_reset_usb(void)
> +{
> + usb_started = false;
> +}
> +
> int do_ut_bootstd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
> {
> struct unit_test *tests = UNIT_TEST_SUITE_START(bootstd_test);
> diff --git a/test/boot/bootstd_common.h b/test/boot/bootstd_common.h
> index 4a126e43ff4..e29036c897c 100644
> --- a/test/boot/bootstd_common.h
> +++ b/test/boot/bootstd_common.h
> @@ -53,4 +53,12 @@ int bootstd_setup_for_tests(void);
> */
> int bootstd_test_check_mmc_hunter(struct unit_test_state *uts);
>
> +/**
> + * bootstd_reset_usb() - Reset the USB subsystem
> + *
> + * Resets USB so that it can be started (and scanning) again. This is useful in
> + * tests which need to use USB.
> + */
> +void bootstd_reset_usb(void);
> +
> #endif
next prev parent reply other threads:[~2024-08-07 1:56 UTC|newest]
Thread overview: 71+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-06 12:58 [PATCH v2 00/39] efi: Add a test for EFI bootmeth Simon Glass
2024-08-06 12:58 ` [PATCH v2 01/39] nvmxip: Drop the message on probe Simon Glass
2024-08-06 12:58 ` [PATCH v2 02/39] nvmxip: Avoid probing on boot Simon Glass
2024-08-06 12:58 ` [PATCH v2 03/39] bootstd: Add UT_TESTF_CONSOLE_REC to bootflow tests Simon Glass
2024-08-06 12:58 ` [PATCH v2 04/39] test/py: Fix some pylint warnings in test_ut.py Simon Glass
2024-08-06 12:58 ` [PATCH v2 05/39] scripts: Update pylint.base Simon Glass
2024-08-06 12:58 ` [PATCH v2 06/39] bootstd: Create a function to reset USB Simon Glass
2024-08-07 1:56 ` Heinrich Schuchardt [this message]
2024-08-07 14:36 ` Simon Glass
2024-08-08 21:07 ` Heinrich Schuchardt
2024-08-11 14:50 ` Simon Glass
2024-08-06 12:58 ` [PATCH v2 07/39] usb: Drop old non-DM code Simon Glass
2024-08-06 12:58 ` [PATCH v2 08/39] log: Add a new log category for the console Simon Glass
2024-08-06 12:58 ` [PATCH v2 09/39] usb: Add DEV_FLAGS_DM to stdio for USB keyboard Simon Glass
2024-08-06 12:58 ` [PATCH v2 10/39] dm: usb: Deal with USB keyboard persisting across tests Simon Glass
2024-08-06 12:58 ` [PATCH v2 11/39] test: mbr: Adjust test to use lower-case hex Simon Glass
2024-08-06 12:58 ` [PATCH v2 12/39] test: mbr: Adjust test to drop 0x Simon Glass
2024-08-06 12:58 ` [PATCH v2 13/39] sandbox: Change the range used for memory-mapping tags Simon Glass
2024-08-06 12:58 ` [PATCH v2 14/39] sandbox: Update cpu to use logging Simon Glass
2024-08-06 12:58 ` [PATCH v2 15/39] sandbox: Unmap old tags Simon Glass
2024-08-06 12:58 ` [PATCH v2 16/39] sandbox: Add some debugging to pci_io Simon Glass
2024-08-06 12:58 ` [PATCH v2 17/39] sandbox: Implement reference counting for address mapping Simon Glass
2024-08-06 12:58 ` [PATCH v2 18/39] mmc: Use map_sysmem() with buffers in the mmc command Simon Glass
2024-08-06 12:58 ` [PATCH v2 19/39] read: Use map_sysmem() with buffers in the read command Simon Glass
2024-08-08 10:20 ` Ilias Apalodimas
2024-08-06 12:58 ` [PATCH v2 20/39] cmd: Fix memory-mapping in cmp command Simon Glass
2024-08-06 12:58 ` [PATCH v2 21/39] test: mbr: Unmap the buffers after use Simon Glass
2024-08-08 10:13 ` Ilias Apalodimas
2024-08-06 12:58 ` [PATCH v2 22/39] test: mbr: Use a constant for the block size Simon Glass
2024-08-08 10:15 ` Ilias Apalodimas
2024-08-06 12:58 ` [PATCH v2 23/39] test: mbr: Use RAM for the buffers Simon Glass
2024-08-06 12:58 ` [PATCH v2 24/39] test: mbr: Drop a duplicate test Simon Glass
2024-08-06 12:58 ` [PATCH v2 25/39] efi: Use puts() in cout so that console recording works Simon Glass
2024-08-07 0:37 ` Heinrich Schuchardt
2024-08-06 12:58 ` [PATCH v2 26/39] efi_loader: Put back copyright message Simon Glass
2024-08-06 12:58 ` [PATCH v2 27/39] efi_loader: Rename and move CMD_BOOTEFI_HELLO_COMPILE Simon Glass
2024-08-07 1:01 ` Heinrich Schuchardt
2024-08-06 12:58 ` [PATCH v2 28/39] efi_loader: Shorten the app rules Simon Glass
2024-08-07 1:04 ` Heinrich Schuchardt
2024-08-06 12:58 ` [PATCH v2 29/39] efi_loader: Shorten the app rules further Simon Glass
2024-08-07 1:05 ` Heinrich Schuchardt
2024-08-07 7:00 ` Ilias Apalodimas
2024-08-06 12:58 ` [PATCH v2 30/39] efi: Show the vendor in helloworld Simon Glass
2024-08-07 1:22 ` Heinrich Schuchardt
2024-08-06 12:58 ` [PATCH v2 31/39] Revert "bootdev: avoid infinite probe loop" Simon Glass
2024-08-07 1:27 ` Heinrich Schuchardt
2024-08-06 12:58 ` [PATCH v2 32/39] bootstd: Make bootdev_next_prio() continue after failure Simon Glass
2024-08-06 12:58 ` [PATCH v2 33/39] efi: Use the same filename for all sandbox builds Simon Glass
2024-08-08 10:18 ` Ilias Apalodimas
2024-08-06 12:58 ` [PATCH v2 34/39] bootstd: Add debugging for efi bootmeth Simon Glass
2024-08-06 12:58 ` [PATCH v2 35/39] efi: Disable ANSI output for tests Simon Glass
2024-08-06 12:58 ` [PATCH v2 36/39] efi: Add a test app Simon Glass
2024-08-07 1:42 ` Heinrich Schuchardt
2024-08-07 14:36 ` Simon Glass
2024-08-08 21:17 ` Heinrich Schuchardt
2024-08-11 14:50 ` Simon Glass
2024-08-06 12:58 ` [PATCH v2 37/39] efi: Avoid using sandbox virtio devices Simon Glass
2024-08-07 1:47 ` Heinrich Schuchardt
2024-08-07 1:56 ` Tom Rini
2024-08-08 18:44 ` Simon Glass
2024-08-08 20:06 ` Tom Rini
2024-08-11 14:50 ` Simon Glass
2024-08-14 17:56 ` Tom Rini
2024-08-15 20:33 ` Simon Glass
2024-08-15 22:56 ` Tom Rini
2024-08-16 1:34 ` Simon Glass
2024-08-16 23:53 ` Simon Glass
2024-08-22 15:13 ` Tom Rini
2024-08-22 17:11 ` Simon Glass
2024-08-06 12:58 ` [PATCH v2 38/39] test: Set up an image suitable for EFI testing Simon Glass
2024-08-06 12:58 ` [PATCH v2 39/39] efi: Add a test for the efi bootmeth Simon Glass
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=eb48b869-a130-46a0-b35b-22bdb30daa7f@gmx.de \
--to=xypron.glpk@gmx.de \
--cc=caleb.connolly@linaro.org \
--cc=dan.carpenter@linaro.org \
--cc=ilias.apalodimas@linaro.org \
--cc=marek.vasut+renesas@mailbox.org \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.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