diff options
author | Simon Glass <sjg@chromium.org> | 2024-10-09 18:29:03 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2024-10-15 10:24:27 -0600 |
commit | 85d7dae377ac172a5361bbb526b552db39c5ceca (patch) | |
tree | c0a392c592cd7cbd1abd62c29622683504db59dd /test/py/conftest.py | |
parent | 681b8f86e4719ba4d8d0bd4f8b6be056277499f6 (diff) |
test: Detect dead connections
When the connection to a board dies, assume it is dead forever until
some user action is taken. Skip all remaining tests. This avoids CI
runs taking an hour, with hundreds of 30-second timeouts all to no
avail.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test/py/conftest.py')
-rw-r--r-- | test/py/conftest.py | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/test/py/conftest.py b/test/py/conftest.py index 85e1979dc79..46a410cf268 100644 --- a/test/py/conftest.py +++ b/test/py/conftest.py @@ -24,6 +24,7 @@ import pytest import re from _pytest.runner import runtestprotocol import sys +from u_boot_spawn import BootFail, Timeout, Unexpected, handle_exception # Globals: The HTML log file, and the connection to the U-Boot console. log = None @@ -254,6 +255,7 @@ def pytest_configure(config): ubconfig.board_identity = board_identity ubconfig.gdbserver = gdbserver ubconfig.dtb = build_dir + '/arch/sandbox/dts/test.dtb' + ubconfig.connection_ok = True env_vars = ( 'board_type', @@ -420,8 +422,21 @@ def u_boot_console(request): Returns: The fixture value. """ - - console.ensure_spawned() + if not ubconfig.connection_ok: + pytest.skip('Cannot get target connection') + return None + try: + console.ensure_spawned() + except OSError as err: + handle_exception(ubconfig, console, log, err, 'Lab failure', True) + except Timeout as err: + handle_exception(ubconfig, console, log, err, 'Lab timeout', True) + except BootFail as err: + handle_exception(ubconfig, console, log, err, 'Boot fail', True, + console.get_spawn_output()) + except Unexpected: + handle_exception(ubconfig, console, log, err, 'Unexpected test output', + False) return console anchors = {} |