test: Use a constant for the test timeout

Declare a constant rather than open-coding the same value twice.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
This commit is contained in:
Simon Glass 2024-10-09 18:28:58 -06:00 committed by Tom Rini
parent d2061828a4
commit 189c4d9f5c

View file

@ -26,6 +26,9 @@ pattern_error_please_reset = re.compile('### ERROR ### Please RESET the board ##
PAT_ID = 0 PAT_ID = 0
PAT_RE = 1 PAT_RE = 1
# Timeout before expecting the console to be ready (in milliseconds)
TIMEOUT_MS = 30000
bad_pattern_defs = ( bad_pattern_defs = (
('spl_signon', pattern_u_boot_spl_signon), ('spl_signon', pattern_u_boot_spl_signon),
('main_signon', pattern_u_boot_main_signon), ('main_signon', pattern_u_boot_main_signon),
@ -422,7 +425,7 @@ class ConsoleBase(object):
# Reset the console timeout value as some tests may change # Reset the console timeout value as some tests may change
# its default value during the execution # its default value during the execution
if not self.config.gdbserver: if not self.config.gdbserver:
self.p.timeout = 30000 self.p.timeout = TIMEOUT_MS
return return
try: try:
self.log.start_section('Starting U-Boot') self.log.start_section('Starting U-Boot')
@ -433,7 +436,7 @@ class ConsoleBase(object):
# future, possibly per-test to be optimal. This works for 'help' # future, possibly per-test to be optimal. This works for 'help'
# on board 'seaboard'. # on board 'seaboard'.
if not self.config.gdbserver: if not self.config.gdbserver:
self.p.timeout = 30000 self.p.timeout = TIMEOUT_MS
self.p.logfile_read = self.logstream self.p.logfile_read = self.logstream
if expect_reset: if expect_reset:
loop_num = 2 loop_num = 2