diff mbox

[U-Boot] test/py: dfu: wait for USB device to go away at boot

Message ID 1462489326-10091-1-git-send-email-swarren@wwwdotorg.org
State Accepted
Commit daa69f5f5dba48406836b1879434fc4af4bb7df7
Delegated to: Tom Rini
Headers show

Commit Message

Stephen Warren May 5, 2016, 11:02 p.m. UTC
From: Stephen Warren <swarren@nvidia.com>

It can take a while for a host machine to notice that a USB device has
disconnected, and process the change. At the end of the DFU test, we wait
up to 10 seconds for this to happen. This change makes the test wait the
same (up to) 10 seconds at the start of the test for any previously active
USB device-mode session to be cleaned up. Such as session might have been
used to download U-Boot into memory for example; this is certainly true
on my Tegra test systems. This changes should solve the DFU test
intermittency issues I've been seeing on some Tegra devices.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
 test/py/tests/test_dfu.py | 2 ++
 1 file changed, 2 insertions(+)

Comments

Tom Rini May 6, 2016, 5:48 p.m. UTC | #1
On Thu, May 05, 2016 at 05:02:06PM -0600, Stephen Warren wrote:

> From: Stephen Warren <swarren@nvidia.com>
> 
> It can take a while for a host machine to notice that a USB device has
> disconnected, and process the change. At the end of the DFU test, we wait
> up to 10 seconds for this to happen. This change makes the test wait the
> same (up to) 10 seconds at the start of the test for any previously active
> USB device-mode session to be cleaned up. Such as session might have been
> used to download U-Boot into memory for example; this is certainly true
> on my Tegra test systems. This changes should solve the DFU test
> intermittency issues I've been seeing on some Tegra devices.
> 
> Signed-off-by: Stephen Warren <swarren@nvidia.com>

Applied to u-boot/master, thanks!
diff mbox

Patch

diff --git a/test/py/tests/test_dfu.py b/test/py/tests/test_dfu.py
index 8649d8731b73..585e6b29d7f8 100644
--- a/test/py/tests/test_dfu.py
+++ b/test/py/tests/test_dfu.py
@@ -136,6 +136,8 @@  def test_dfu(u_boot_console, env__usb_dev_port, env__dfu_config):
             Nothing.
         """
 
+        u_boot_utils.wait_until_file_open_fails(
+            env__usb_dev_port['host_usb_dev_node'], True)
         fh = u_boot_utils.attempt_to_open_file(
             env__usb_dev_port['host_usb_dev_node'])
         if fh: