[U-Boot] [PATCH] test/py: ignore console read exceptions after test failure

Stephen Warren swarren at wwwdotorg.org
Thu Sep 20 22:52:02 UTC 2018


On 09/20/2018 01:43 PM, Heinrich Schuchardt wrote:
> On 09/20/2018 09:24 PM, Stephen Warren wrote:
>> From: Stephen Warren <swarren at 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 at nvidia.com>
>> ---
>>   test/py/u_boot_console_base.py | 11 +++++++++++
>>   1 file changed, 11 insertions(+)
>>
>> diff --git a/test/py/u_boot_console_base.py b/test/py/u_boot_console_base.py
>> index a14bad6e8c50..e337f3a84a96 100644
>> --- a/test/py/u_boot_console_base.py
>> +++ b/test/py/u_boot_console_base.py
>> @@ -305,6 +305,17 @@ class ConsoleBase(object):
>>               # cause the console output to be read and logged.
>>               self.p.expect(['This should never match U-Boot output'])
>>           except u_boot_spawn.Timeout:
>> +	    # We expect a timeout, since U-Boot won't print what we waited
>> +	    # for. Squash the expected timeout exception.
>> +            pass
> 
> This block is redundant. You have a catch-all below with the same
> processing of the exception. So I would rather drop it. The comment
> could be integrated below.
> 
> Timeout exceptions are currently caught in
> test/py/u_boot_console_base.py:307
> Your patch could delete that 'except' as it becomes superfluous now.

That was deliberate to emphasize the two cases. But since I realized 
that I need to re-post the patch to fix a TAB/space mixup, I guess I'll 
fix it up.


More information about the U-Boot mailing list