aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2022-04-24 23:31:02 -0600
committerTom Rini <trini@konsulko.com>2022-04-25 10:00:03 -0400
commit026e2136f834feb19acc95efd61e6613f37234de (patch)
tree2cb9f416006e3cb716f10f54220c8301bbb58a29
parent9bd2f62d12a53370822f0514ccc32e45209abc50 (diff)
downloadu-boot-026e2136f834feb19acc95efd61e6613f37234de.zip
u-boot-026e2136f834feb19acc95efd61e6613f37234de.tar.gz
u-boot-026e2136f834feb19acc95efd61e6613f37234de.tar.bz2
test: dm: Restart USB before assuming it is stopped
Update the blk test to stop USB first, in case another test has started it. Signed-off-by: Simon Glass <sjg@chromium.org>
-rw-r--r--test/dm/blk.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/dm/blk.c b/test/dm/blk.c
index 8556cc7..85c3a3b 100644
--- a/test/dm/blk.c
+++ b/test/dm/blk.c
@@ -15,6 +15,9 @@
DECLARE_GLOBAL_DATA_PTR;
+/* Allow resetting the USB-started flag */
+extern char usb_started;
+
/* Test that block devices can be created */
static int dm_test_blk_base(struct unit_test_state *uts)
{
@@ -66,8 +69,11 @@ static int dm_test_blk_usb(struct unit_test_state *uts)
struct udevice *usb_dev, *dev;
struct blk_desc *dev_desc;
+ usb_started = false;
+
/* Get a flash device */
state_set_skip_delays(true);
+ ut_assertok(usb_stop());
ut_assertok(usb_init());
ut_assertok(uclass_get_device(UCLASS_MASS_STORAGE, 0, &usb_dev));
ut_assertok(blk_get_device_by_str("usb", "0", &dev_desc));