diff mbox series

[U-Boot,v2,01/17] test/py: ignore console read exceptions after test failure

Message ID 20181002031247.93384-2-sjg@chromium.org
State Accepted
Delegated to: Simon Glass
Headers show
Series test: Various test refinements and improvements | expand

Commit Message

Simon Glass Oct. 2, 2018, 3:12 a.m. UTC
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>
Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v2: None

 test/py/u_boot_console_base.py | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

Comments

Stephen Warren Oct. 4, 2018, 4:01 p.m. UTC | #1
On 10/01/2018 09:12 PM, Simon Glass wrote:
> 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.

This probably shouldn't be in this series since I sent it separately as 
a standalone patch a while ago.
Simon Glass Oct. 4, 2018, 4:27 p.m. UTC | #2
Hi Stephen,

On 4 October 2018 at 10:01, Stephen Warren <swarren@wwwdotorg.org> wrote:
> On 10/01/2018 09:12 PM, Simon Glass wrote:
>>
>> 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.
>
>
> This probably shouldn't be in this series since I sent it separately as a
> standalone patch a while ago.

Sorry about that. I picked it up and assumed it would fall out when I
rebased to master, but I suppose your patch is not yet applied.

Regards,
Simon
Simon Glass Oct. 10, 2018, 12:01 a.m. UTC | #3
Hi Stephen,

On 4 October 2018 at 10:01, Stephen Warren <swarren@wwwdotorg.org> wrote:
> On 10/01/2018 09:12 PM, Simon Glass wrote:
>>
>> 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.
>
>
> This probably shouldn't be in this series since I sent it separately as a
> standalone patch a while ago.

Sorry about that. I picked it up and assumed it would fall out when I
rebased to master, but I suppose your patch is not yet applied.

Regards,
Simon

Applied to u-boot-dm
diff mbox series

Patch

diff --git a/test/py/u_boot_console_base.py b/test/py/u_boot_console_base.py
index a14bad6e8c5..326b2ac51fb 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