All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/1] test/py: catch errors occurring when reading the console
@ 2018-09-18 17:21 Heinrich Schuchardt
  2018-09-18 17:23 ` Stephen Warren
  2018-09-18 22:05 ` Alexander Graf
  0 siblings, 2 replies; 10+ messages in thread
From: Heinrich Schuchardt @ 2018-09-18 17:21 UTC (permalink / raw)
  To: u-boot

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 <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
---
I suggest that Alex takes the patch because we need it when working on the
efi-next branch.

v2
	replace TAB by spaces
	fix typo in subject
---
 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..7ee876b101 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=1000000)
+        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

^ permalink raw reply related	[flat|nested] 10+ messages in thread
* [U-Boot] [PATCH 1/1] test/py: catch errors occurring when reading the console
@ 2018-09-20 18:19 Heinrich Schuchardt
  2018-09-20 19:07 ` Stephen Warren
  0 siblings, 1 reply; 10+ messages in thread
From: Heinrich Schuchardt @ 2018-09-20 18:19 UTC (permalink / raw)
  To: u-boot

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

When the py test is running it is connected via pipes to the U-Boot
process. If the U-Boot process ends prematurely, e.g. due to a
segmentation fault, the pipes are broken. Trying to read from a broken
pipe results in an OSError. Catch the exception and treat the broken pipe
like any other end of output. By returning None expect() indicates that
the output does not match.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
---
I suggest that Alex takes the patch because we need it when working on
the efi-next branch.

v3
	add more comments
v2
	replace TAB by spaces
	fix type in subject
---
 test/py/u_boot_spawn.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/test/py/u_boot_spawn.py b/test/py/u_boot_spawn.py
index b011a3e3da..adc1d00287 100644
--- a/test/py/u_boot_spawn.py
+++ b/test/py/u_boot_spawn.py
@@ -181,6 +181,14 @@ 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=1000000)
+        except OSError, EOFError:
+            # When the py test is running it is connected via pipes to the
+            # U-Boot process. If the U-Boot process ends prematurely, e.g. due
+            # to a segmentation fault, the pipes are broken. Trying to read
+            # from a broken pipe results in an OSError. Treat the broken pipe
+            # like any other end of output. By returning None expect()
+            # indicates that the output does not match.
+            pass
         finally:
             if self.logfile_read:
                 self.logfile_read.flush()
-- 
2.18.0

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

end of thread, other threads:[~2018-09-20 19:07 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-18 17:21 [U-Boot] [PATCH 1/1] test/py: catch errors occurring when reading the console Heinrich Schuchardt
2018-09-18 17:23 ` Stephen Warren
2018-09-19  0:43   ` Heinrich Schuchardt
2018-09-19 15:24     ` Stephen Warren
2018-09-19 16:45       ` Heinrich Schuchardt
2018-09-20 19:06         ` Stephen Warren
2018-09-19 15:29     ` Simon Glass
2018-09-18 22:05 ` Alexander Graf
2018-09-20 18:19 Heinrich Schuchardt
2018-09-20 19:07 ` Stephen Warren

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.