Lines Matching +full:re +full:- +full:config

1 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved.
5 # Common logic to interact with U-Boot via the console. This class provides
6 # the interface that tests use to execute U-Boot shell commands and wait for
7 # their results. Sub-classes exist to perform board-type-specific setup
8 # operations, such as spawning a sub-process for Sandbox, or attaching to the
14 import re
18 # Regexes for text we expect U-Boot to send to the console.
19 pattern_u_boot_spl_signon = re.compile('(U-Boot SPL \\d{4}\\.\\d{2}[^\r\n]*\\))')
20 pattern_u_boot_main_signon = re.compile('(U-Boot \\d{4}\\.\\d{2}[^\r\n]*\\))')
21 pattern_stop_autoboot_prompt = re.compile('Hit any key to stop autoboot: ')
22 pattern_unknown_command = re.compile('Unknown command \'.*\' - try \'help\'')
23 pattern_error_notification = re.compile('## Error: ')
24 pattern_error_please_reset = re.compile('### ERROR ### Please RESET the board ###')
55 self.console.disable_check_count[self.check_type] -= 1
75 """The interface through which test functions interact with the U-Boot
80 def __init__(self, log, config, max_fifo_fill): argument
81 """Initialize a U-Boot console connection.
83 Can only usefully be called by sub-classes.
86 log: A mulptiplex_log.Logfile object, to which the U-Boot output
88 config: A configuration data structure, as built by conftest.py.
89 max_fifo_fill: The maximum number of characters to send to U-Boot
90 command-line before waiting for U-Boot to echo the characters
91 back. For UART-based HW without HW flow control, this value
93 overflow, assuming that U-Boot can't keep up with full-rate
101 self.config = config
107 self.prompt = self.config.buildconfig['config_sys_prompt'][1:-1]
108 self.prompt_compiled = re.compile('^' + re.escape(self.prompt), re.MULTILINE)
123 """Terminate the connection to the U-Boot console.
125 This function is only useful once all interaction with U-Boot is
127 received from U-Boot.
142 """Execute a command via the U-Boot console.
144 The command is always sent to U-Boot.
146 U-Boot echoes any command back to its output, and this function
148 wait_for_echo=False, which is useful e.g. when sending CTRL-C to
149 interrupt a long-running command such as "ums".
153 also useful when sending CTRL-C.
157 setting wait_for_prompt=False, which is useful when invoking a long-
162 wait_for_echo: Boolean indicating whether to wait for U-Boot to
167 command prompt to be sent by U-Boot. This typically occurs
174 The output from U-Boot during command execution. In other
175 words, the text U-Boot emitted between the point it echod the
194 chunk = re.escape(chunk)
200 self.bad_pattern_ids[m - 1])
207 self.bad_pattern_ids[m - 1])
238 """Send a CTRL-C character to U-Boot.
240 This is useful in order to stop execution of long-running synchronous
250 self.log.action('Sending Ctrl-C')
254 """Wait for a pattern to be emitted by U-Boot.
256 This is useful when a long-running command such as "dfu" is executing,
262 not a regular expression) or an re object.
269 text = re.escape(text)
273 self.bad_pattern_ids[m - 1])
276 """Read from and log the U-Boot console for a short time.
278 U-Boot's console output is only logged when the test code actively
279 waits for U-Boot to emit specific data. There are cases where tests
280 can fail without doing this. For example, if a test asks U-Boot to
281 enable USB device mode, then polls until a host-side device node
282 exists. In such a case, it is useful to log U-Boot's console output
283 in case U-Boot printed clues as to why the host-side even did not
293 # If we are already not connected to U-Boot, there's nothing to drain.
304 # Wait for something U-Boot will likely never send. This will
306 self.p.expect(['This should never match U-Boot output'])
308 # We expect a timeout, since U-Boot won't print what we waited
312 # drain (and log) the U-Boot console output after a failed test.
313 # The U-Boot process will be restarted, or target board reset, once
315 # additional errors, so they're squashed so that the rest of the
316 # post-test-failure cleanup code can continue operation, and
323 """Ensure a connection to a correctly running U-Boot instance.
326 hardware, as defined by the implementation sub-class.
340 self.log.start_section('Starting U-Boot')
345 # future, possibly per-test to be optimal. This works for 'help'
347 if not self.config.gdbserver:
350 bcfg = self.config.buildconfig
354 env_spl_skipped = self.config.env.get('env__spl_skipped',
361 self.bad_pattern_ids[m - 1])
365 self.bad_pattern_ids[m - 1])
376 self.bad_pattern_ids[m - 2])
385 self.log.end_section('Starting U-Boot')
388 """Shut down all interaction with the U-Boot instance.
390 This is used when an error is detected prior to re-establishing a
391 connection with a fresh U-Boot instance.
410 """Shut down and restart U-Boot."""
415 """Return the start-up output from U-Boot
425 """Assert that a command's output includes the U-Boot signon message.
440 """Temporarily disable an error check of U-Boot's output.
446 check_type: The type of error-check to disable. Valid values may