test: Tidy up remaining exceptions

Use the new handle_exception() function from ConsoleBase also.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass 2024-10-09 18:29:04 -06:00 committed by Tom Rini
parent 85d7dae377
commit 9fa4be6598

View file

@ -14,7 +14,7 @@ import pytest
import re import re
import sys import sys
import u_boot_spawn import u_boot_spawn
from u_boot_spawn import BootFail, Timeout, Unexpected from u_boot_spawn import BootFail, Timeout, Unexpected, handle_exception
# Regexes for text we expect U-Boot to send to the console. # Regexes for text we expect U-Boot to send to the console.
pattern_u_boot_spl_signon = re.compile('(U-Boot SPL \\d{4}\\.\\d{2}[^\r\n]*\\))') pattern_u_boot_spl_signon = re.compile('(U-Boot SPL \\d{4}\\.\\d{2}[^\r\n]*\\))')
@ -293,12 +293,12 @@ class ConsoleBase(object):
# indentation. # indentation.
return self.p.before.strip('\r\n') return self.p.before.strip('\r\n')
except Timeout as exc: except Timeout as exc:
self.log.error(str(exc)) handle_exception(self.config, self, self.log, exc, 'Lab failure',
self.cleanup_spawn() True)
raise raise
except BootFail as ex: except BootFail as exc:
self.log.error(str(ex)) handle_exception(self.config, self, self.log, exc, 'Boot fail',
self.cleanup_spawn() True, self.get_spawn_output())
raise raise
finally: finally:
self.log.timestamp() self.log.timestamp()