pytest: Show a message when sandbox crashes
PATCH v2 1/1 pytest: Show a message when sandbox crashes
When a test hands on a real board there is no way on the console to obtain any information about why it hung.
With sandbox we can actually find out that it died and get a signal or exit code. Add this to make it easier to figure out what happened.
So instead of:
test/py/u_boot_spawn.py:171: in expect
c = os.read(self.fd, 1024).decode(errors='replace')
E OSError: [Errno 5] Input/output error
We get:
test/py/u_boot_spawn.py:171: in expect
c = os.read(self.fd, 1024).decode(errors='replace')
E ValueError: U-Boot exited with signal 11 (Signals.SIGSEGV)
---
Changes in v2:
- Fix a few test failure it causes
doc/develop/py_testing.rst | 8 ++++++ test/py/u_boot_spawn.py | 56 ++++++++++++++++++++++++++++++-------- 2 files changed, 52 insertions(+), 12 deletions(-)
doc/develop/py_testing.rst +8 -0
@@ -103,6 +103,14 @@ will be written to `${build_dir}/test-log.html`. This is best viewed in a web browser, but may be read directly as plain text, perhaps with the aid of the `html2text` utility. +If sandbox crashes (e.g. with a segfault) you will see message like this:: + + + test/py/u_boot_spawn.py:171: in expect + c = os.read(self.fd, 1024).decode(errors='replace') + E ValueError: U-Boot exited with signal 11 (Signals.SIGSEGV) + + Controlling output ~~~~~~~~~~~~~~~~~~
test/py/u_boot_spawn.py +44 -12
84 lines not on this page · raw message
Signature · 1 line
2.33.0.882.g93a45727a2-goog
Quoted 12 lines · Simon Glass
When a test hands on a real board there is no way on the console to obtain any information about why it hung.
With sandbox we can actually find out that it died and get a signal or exit code. Add this to make it easier to figure out what happened.
So instead of:
test/py/u_boot_spawn.py:171: in expectc = os.read(self.fd, 1024).decode(errors='replace')E OSError: [Errno 5] Input/output error
Quoted 7 lines
We get:
test/py/u_boot_spawn.py:171: in expectc = os.read(self.fd, 1024).decode(errors='replace')E ValueError: U-Boot exited with signal 11 (Signals.SIGSEGV)
Signed-off-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom