All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH V2] test/py: ignore console read exceptions after test failure
@ 2018-09-20 22:55 Stephen Warren
  2018-09-21  5:50 ` Heinrich Schuchardt
  2018-10-07  0:28 ` [U-Boot] [U-Boot, " Tom Rini
  0 siblings, 2 replies; 5+ messages in thread
From: Stephen Warren @ 2018-09-20 22:55 UTC (permalink / raw)
  To: u-boot

From: Stephen Warren <swarren@nvidia.com>

After a test has failed, test/py drains the U-Boot console log to ensure
that any relevant output is captured. At this point, we don't care about
detecting any additional errors, since the test is already known to have
failed, and U-Boot will be restarted. To ensure that the test cleanup code
is not interrupted, and can correctly terminate the log sections for the
failed test, ignore any exception that occurs while reading the U-Boot
console output during this limited period of time.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
v2:
* Combine the two except cases into one, since one was a superset of the
  other.
* Fix TAB-vs-spaces issue in identation.
---
 test/py/u_boot_console_base.py | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/test/py/u_boot_console_base.py b/test/py/u_boot_console_base.py
index a14bad6e8c50..326b2ac51fbf 100644
--- a/test/py/u_boot_console_base.py
+++ b/test/py/u_boot_console_base.py
@@ -304,7 +304,17 @@ class ConsoleBase(object):
             # Wait for something U-Boot will likely never send. This will
             # cause the console output to be read and logged.
             self.p.expect(['This should never match U-Boot output'])
-        except u_boot_spawn.Timeout:
+        except:
+            # We expect a timeout, since U-Boot won't print what we waited
+            # for. Squash it when it happens.
+            #
+            # Squash any other exception too. This function is only used to
+            # drain (and log) the U-Boot console output after a failed test.
+            # The U-Boot process will be restarted, or target board reset, once
+            # this function returns. So, we don't care about detecting any
+            # additional errors, so they're squashed so that the rest of the
+            # post-test-failure cleanup code can continue operation, and
+            # correctly terminate any log sections, etc.
             pass
         finally:
             self.p.timeout = orig_timeout
-- 
2.18.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-10-07  0:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-20 22:55 [U-Boot] [PATCH V2] test/py: ignore console read exceptions after test failure Stephen Warren
2018-09-21  5:50 ` Heinrich Schuchardt
2018-09-21 15:39   ` Stephen Warren
2018-10-04 16:35     ` Stephen Warren
2018-10-07  0:28 ` [U-Boot] [U-Boot, " Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.