Lines Matching refs:self

48     def __init__(self, console, check_type):  argument
49 self.console = console
50 self.check_type = check_type
52 def __enter__(self): argument
53 self.console.disable_check_count[self.check_type] += 1
54 self.console.eval_bad_patterns()
56 def __exit__(self, extype, value, traceback): argument
57 self.console.disable_check_count[self.check_type] -= 1
58 self.console.eval_bad_patterns()
65 def __init__(self, console, timeout): argument
66 self.p = console.p
67 self.orig_timeout = self.p.timeout
68 self.p.timeout = timeout
70 def __enter__(self): argument
71 return self
73 def __exit__(self, extype, value, traceback): argument
74 self.p.timeout = self.orig_timeout
82 def __init__(self, log, config, max_fifo_fill): argument
102 self.log = log
103 self.config = config
104 self.max_fifo_fill = max_fifo_fill
106 self.logstream = self.log.get_stream('console', sys.stdout)
109 self.prompt = self.config.buildconfig['config_sys_prompt'][1:-1]
110 self.prompt_compiled = re.compile('^' + re.escape(self.prompt), re.MULTILINE)
111 self.p = None
112 self.disable_check_count = {pat[PAT_ID]: 0 for pat in bad_pattern_defs}
113 self.eval_bad_patterns()
115 self.at_prompt = False
116 self.at_prompt_logevt = None
118 def eval_bad_patterns(self): argument
119 self.bad_patterns = [pat[PAT_RE] for pat in bad_pattern_defs \
120 if self.disable_check_count[pat[PAT_ID]] == 0]
121 self.bad_pattern_ids = [pat[PAT_ID] for pat in bad_pattern_defs \
122 if self.disable_check_count[pat[PAT_ID]] == 0]
124 def close(self): argument
138 if self.p:
139 self.p.close()
140 self.logstream.close()
142 def run_command(self, cmd, wait_for_echo=True, send_nl=True, argument
181 if self.at_prompt and \
182 self.at_prompt_logevt != self.logstream.logfile.cur_evt:
183 self.logstream.write(self.prompt, implicit=True)
186 self.at_prompt = False
191 chunk = cmd[:self.max_fifo_fill]
192 cmd = cmd[self.max_fifo_fill:]
193 self.p.send(chunk)
198 m = self.p.expect([chunk] + self.bad_patterns)
200 self.at_prompt = False
202 self.bad_pattern_ids[m - 1])
205 m = self.p.expect([self.prompt_compiled] + self.bad_patterns)
207 self.at_prompt = False
209 self.bad_pattern_ids[m - 1])
210 self.at_prompt = True
211 self.at_prompt_logevt = self.logstream.logfile.cur_evt
214 return self.p.before.strip('\r\n')
216 self.log.error(str(ex))
217 self.cleanup_spawn()
220 self.log.timestamp()
222 def run_command_list(self, cmds): argument
236 output.append(self.run_command(cmd))
239 def ctrlc(self): argument
252 self.log.action('Sending Ctrl-C')
253 self.run_command(chr(3), wait_for_echo=False, send_nl=False)
255 def wait_for(self, text): argument
272 m = self.p.expect([text] + self.bad_patterns)
275 self.bad_pattern_ids[m - 1])
277 def drain_console(self): argument
299 if not self.p:
302 orig_timeout = self.p.timeout
305 self.p.timeout = 1000
308 self.p.expect(['This should never match U-Boot output'])
322 self.p.timeout = orig_timeout
324 def ensure_spawned(self): argument
339 if self.p:
342 self.log.start_section('Starting U-Boot')
343 self.at_prompt = False
344 self.p = self.get_spawn()
349 if not self.config.gdbserver:
350 self.p.timeout = 30000
351 self.p.logfile_read = self.logstream
352 bcfg = self.config.buildconfig
356 env_spl_skipped = self.config.env.get('env__spl_skipped',
358 env_spl2_skipped = self.config.env.get('env__spl2_skipped',
361 m = self.p.expect([pattern_u_boot_spl_signon] +
362 self.bad_patterns)
365 self.bad_pattern_ids[m - 1])
367 m = self.p.expect([pattern_u_boot_spl2_signon] +
368 self.bad_patterns)
371 self.bad_pattern_ids[m - 1])
372 m = self.p.expect([pattern_u_boot_main_signon] + self.bad_patterns)
375 self.bad_pattern_ids[m - 1])
376 self.u_boot_version_string = self.p.after
378 m = self.p.expect([self.prompt_compiled,
379 pattern_stop_autoboot_prompt] + self.bad_patterns)
383 self.p.send(' ')
386 self.bad_pattern_ids[m - 2])
387 self.at_prompt = True
388 self.at_prompt_logevt = self.logstream.logfile.cur_evt
390 self.log.error(str(ex))
391 self.cleanup_spawn()
394 self.log.timestamp()
395 self.log.end_section('Starting U-Boot')
397 def cleanup_spawn(self): argument
413 if self.p:
414 self.p.close()
417 self.p = None
419 def restart_uboot(self): argument
421 self.cleanup_spawn()
422 self.ensure_spawned()
424 def get_spawn_output(self): argument
430 if self.p:
431 return self.p.get_expect_output()
434 def validate_version_string_in_text(self, text): argument
447 assert(self.u_boot_version_string in text)
449 def disable_check(self, check_type): argument
463 return ConsoleDisableCheck(self, check_type)
465 def temporary_timeout(self, timeout): argument
478 return ConsoleSetupTimeout(self, timeout)