Lines Matching refs:self

47     def __init__(self, console, check_type):  argument
48 self.console = console
49 self.check_type = check_type
51 def __enter__(self): argument
52 self.console.disable_check_count[self.check_type] += 1
53 self.console.eval_bad_patterns()
55 def __exit__(self, extype, value, traceback): argument
56 self.console.disable_check_count[self.check_type] -= 1
57 self.console.eval_bad_patterns()
64 def __init__(self, console, timeout): argument
65 self.p = console.p
66 self.orig_timeout = self.p.timeout
67 self.p.timeout = timeout
69 def __enter__(self): argument
70 return self
72 def __exit__(self, extype, value, traceback): argument
73 self.p.timeout = self.orig_timeout
81 def __init__(self, log, config, max_fifo_fill): argument
101 self.log = log
102 self.config = config
103 self.max_fifo_fill = max_fifo_fill
105 self.logstream = self.log.get_stream('console', sys.stdout)
108 self.prompt = self.config.buildconfig['config_sys_prompt'][1:-1]
109 self.prompt_compiled = re.compile('^' + re.escape(self.prompt), re.MULTILINE)
110 self.p = None
111 self.disable_check_count = {pat[PAT_ID]: 0 for pat in bad_pattern_defs}
112 self.eval_bad_patterns()
114 self.at_prompt = False
115 self.at_prompt_logevt = None
117 def eval_bad_patterns(self): argument
118 self.bad_patterns = [pat[PAT_RE] for pat in bad_pattern_defs \
119 if self.disable_check_count[pat[PAT_ID]] == 0]
120 self.bad_pattern_ids = [pat[PAT_ID] for pat in bad_pattern_defs \
121 if self.disable_check_count[pat[PAT_ID]] == 0]
123 def close(self): argument
137 if self.p:
138 self.p.close()
139 self.logstream.close()
141 def run_command(self, cmd, wait_for_echo=True, send_nl=True, argument
180 if self.at_prompt and \
181 self.at_prompt_logevt != self.logstream.logfile.cur_evt:
182 self.logstream.write(self.prompt, implicit=True)
185 self.at_prompt = False
190 chunk = cmd[:self.max_fifo_fill]
191 cmd = cmd[self.max_fifo_fill:]
192 self.p.send(chunk)
197 m = self.p.expect([chunk] + self.bad_patterns)
199 self.at_prompt = False
201 self.bad_pattern_ids[m - 1])
204 m = self.p.expect([self.prompt_compiled] + self.bad_patterns)
206 self.at_prompt = False
208 self.bad_pattern_ids[m - 1])
209 self.at_prompt = True
210 self.at_prompt_logevt = self.logstream.logfile.cur_evt
213 return self.p.before.strip('\r\n')
215 self.log.error(str(ex))
216 self.cleanup_spawn()
219 self.log.timestamp()
221 def run_command_list(self, cmds): argument
235 output.append(self.run_command(cmd))
238 def ctrlc(self): argument
251 self.log.action('Sending Ctrl-C')
252 self.run_command(chr(3), wait_for_echo=False, send_nl=False)
254 def wait_for(self, text): argument
271 m = self.p.expect([text] + self.bad_patterns)
274 self.bad_pattern_ids[m - 1])
276 def drain_console(self): argument
298 if not self.p:
301 orig_timeout = self.p.timeout
304 self.p.timeout = 1000
307 self.p.expect(['This should never match U-Boot output'])
311 self.p.timeout = orig_timeout
313 def ensure_spawned(self): argument
328 if self.p:
331 self.log.start_section('Starting U-Boot')
332 self.at_prompt = False
333 self.p = self.get_spawn()
338 if not self.config.gdbserver:
339 self.p.timeout = 30000
340 self.p.logfile_read = self.logstream
341 bcfg = self.config.buildconfig
345 env_spl_skipped = self.config.env.get('env__spl_skipped',
348 m = self.p.expect([pattern_u_boot_spl_signon] +
349 self.bad_patterns)
352 self.bad_pattern_ids[m - 1])
353 m = self.p.expect([pattern_u_boot_main_signon] + self.bad_patterns)
356 self.bad_pattern_ids[m - 1])
357 self.u_boot_version_string = self.p.after
359 m = self.p.expect([self.prompt_compiled,
360 pattern_stop_autoboot_prompt] + self.bad_patterns)
364 self.p.send(' ')
367 self.bad_pattern_ids[m - 2])
368 self.at_prompt = True
369 self.at_prompt_logevt = self.logstream.logfile.cur_evt
371 self.log.error(str(ex))
372 self.cleanup_spawn()
375 self.log.timestamp()
376 self.log.end_section('Starting U-Boot')
378 def cleanup_spawn(self): argument
394 if self.p:
395 self.p.close()
398 self.p = None
400 def restart_uboot(self): argument
402 self.cleanup_spawn()
403 self.ensure_spawned()
405 def get_spawn_output(self): argument
411 if self.p:
412 return self.p.get_expect_output()
415 def validate_version_string_in_text(self, text): argument
428 assert(self.u_boot_version_string in text)
430 def disable_check(self, check_type): argument
444 return ConsoleDisableCheck(self, check_type)
446 def temporary_timeout(self, timeout): argument
459 return ConsoleSetupTimeout(self, timeout)