From 9686da8b68d734c4a80b36e497dcd9c3df3be6c3 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 1 Jan 2026 11:42:56 -0700 Subject: [PATCH] test/py: Add an option to disable the console timeout When debugging, particularly when stepping through code in a debugger or dealing with very slow operations, the console timeout can interfere. Add a --no-timeout command-line option that disables the console timeout. Adjust get_default_timeout() to checks for both --gdbserver and --no-timeout, returning None to disable timeouts in either case. This consolidates the timeout-disable logic that was previously spread across multiple locations. Series-to: concept Series-cc: heinrich Cover-letter: Malloc debugging and test/py improvements This series adds malloc-debugging features including a traffic log and file output for dumps, along with video optimisations and test/py performance improvements. The overall goal is to speed up pytests and make it easier to debug memory leaks. Changes include: - Sandbox gprof profiling and mcheck runtime-disable support - Video truetype scratch buffer to reduce malloc pressure - Malloc traffic logging with 'malloc log' command - File output for malloc dump and log - test/py performance improvements reducing CPU usage by ~30% END Co-developed-by: Claude Signed-off-by: Simon Glass Series-links: 1:100 Series-version: 2 --- test/py/console_base.py | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/test/py/console_base.py b/test/py/console_base.py index c4472420c31..7f044b587b6 100644 --- a/test/py/console_base.py +++ b/test/py/console_base.py @@ -271,6 +271,19 @@ class ConsoleBase(): # call, where the function returns None (assignment-from-none) return spawn.Spawn([]) + def get_default_timeout(self): + """Get the default timeout for commands. + + Subclasses can override this to provide a different timeout. + For example, sandbox may need a longer timeout when mcheck is enabled. + + Returns: + int: Timeout in milliseconds, or None if timeout is disabled + """ + if self.config.gdbserver or self.config.no_timeout: + return None + return TIMEOUT_MS + def eval_patterns(self): """Set up lists of regexes for patterns we don't expect on console""" self.bad_patterns = [pat.pattern for pat in self.avail_patterns @@ -328,7 +341,7 @@ class ConsoleBase(): m = pattern_ready_prompt.search(self.after) self.u_boot_version_string = m.group(2) self.log.info('Lab: Board is ready') - self.timeout = TIMEOUT_MS + self.timeout = self.get_default_timeout() break if m == 2: self.log.info(f'Found autoboot prompt {m}') @@ -616,8 +629,7 @@ class ConsoleBase(): if self.p: # Reset the console timeout value as some tests may change # its default value during the execution - if not self.config.gdbserver: - self.timeout = TIMEOUT_MS + self.timeout = self.get_default_timeout() return try: self.log.start_section('Starting U-Boot') @@ -628,8 +640,7 @@ class ConsoleBase(): # text if LCD is enabled. This value may need tweaking in the # future, possibly per-test to be optimal. This works for 'help' # on board 'seaboard'. - if not self.config.gdbserver: - self.timeout = TIMEOUT_MS + self.timeout = self.get_default_timeout() self.logfile_read = self.logstream if self.config.use_running_system: # Send an empty command to set up the 'expect' logic. This has