Re: [U-Boot] [PATCH 1/1] test/py: catch errors occuring when reading the console

2018-09-18 Thread Stephen Warren

On 09/17/2018 04:30 PM, Heinrich Schuchardt wrote:

Spawn.exept has a try block without 'except'.

If no output is available an OSError may arise. Catch this exception and
continue testing.



diff --git a/test/py/u_boot_spawn.py b/test/py/u_boot_spawn.py
index b011a3e3da..3c18360e62 100644
--- a/test/py/u_boot_spawn.py
+++ b/test/py/u_boot_spawn.py
@@ -181,6 +181,9 @@ class Spawn(object):
  # unlimited substitutions, but in practice the version of
  # Python in Ubuntu 14.04 appears to default to count=2!
  self.buf = self.re_vt100.sub('', self.buf, count=100)
+except OSError, EOFError:
+   # Reading the the console may result in an error. Catch it.


This line is indented wrong; it mixes in a TAB instead of using spaces.


+pass
  finally:
  if self.logfile_read:
  self.logfile_read.flush()



This doesn't make sense at all. It catches all errors and ignores them. 
It'll turn any error condition into a timeout (presumably, the expected 
data being waited for will never appear) rather than dealing with it 
immediately (due to the thrown exception). Why is this needed?

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 1/1] test/py: catch errors occuring when reading the console

2018-09-17 Thread Simon Glass
On 17 September 2018 at 16:30, Heinrich Schuchardt  wrote:
> Spawn.exept has a try block without 'except'.
>
> If no output is available an OSError may arise. Catch this exception and
> continue testing.
>
> Signed-off-by: Heinrich Schuchardt 
> ---
> I suggest that Alex takes the patch because we need it when working on the
> efi-next branch.
> ---
>  test/py/u_boot_spawn.py | 3 +++
>  1 file changed, 3 insertions(+)

Reviewed-by: Simon Glass 

I am surprised that it produces an exception, though.

>
> diff --git a/test/py/u_boot_spawn.py b/test/py/u_boot_spawn.py
> index b011a3e3da..3c18360e62 100644
> --- a/test/py/u_boot_spawn.py
> +++ b/test/py/u_boot_spawn.py
> @@ -181,6 +181,9 @@ class Spawn(object):
>  # unlimited substitutions, but in practice the version of
>  # Python in Ubuntu 14.04 appears to default to count=2!
>  self.buf = self.re_vt100.sub('', self.buf, count=100)
> +except OSError, EOFError:
> +   # Reading the the console may result in an error. Catch it.
> +pass
>  finally:
>  if self.logfile_read:
>  self.logfile_read.flush()
> --
> 2.18.0
>
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 1/1] test/py: catch errors occuring when reading the console

2018-09-17 Thread Heinrich Schuchardt
Spawn.exept has a try block without 'except'.

If no output is available an OSError may arise. Catch this exception and
continue testing.

Signed-off-by: Heinrich Schuchardt 
---
I suggest that Alex takes the patch because we need it when working on the
efi-next branch.
---
 test/py/u_boot_spawn.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/test/py/u_boot_spawn.py b/test/py/u_boot_spawn.py
index b011a3e3da..3c18360e62 100644
--- a/test/py/u_boot_spawn.py
+++ b/test/py/u_boot_spawn.py
@@ -181,6 +181,9 @@ class Spawn(object):
 # unlimited substitutions, but in practice the version of
 # Python in Ubuntu 14.04 appears to default to count=2!
 self.buf = self.re_vt100.sub('', self.buf, count=100)
+except OSError, EOFError:
+   # Reading the the console may result in an error. Catch it.
+pass
 finally:
 if self.logfile_read:
 self.logfile_read.flush()
-- 
2.18.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot