How to use _execute_daemon method in autotest

Best Python code snippet using autotest_python

autotest.py

Source:autotest.py Github

copy

Full Screen

...490 return ""491 elif stderr_lines[0].startswith("NOTE: autotestd_monitor"):492 del stderr_lines[0]493 return "\n".join(stderr_lines)494 def _execute_daemon(self, section, timeout, stderr_redirector,495 client_disconnect_timeout):496 monitor_dir = self.host.get_tmp_dir()497 daemon_cmd = self.get_daemon_cmd(section, monitor_dir)498 # grab the location for the server-side client log file499 client_log_prefix = self.get_client_log()500 client_log_path = os.path.join(self.results_dir, 'debug',501 client_log_prefix + '.log')502 client_log = open(client_log_path, 'w', 0)503 self.copy_client_config_file(client_log_prefix)504 stdout_read = stderr_read = 0505 self.host.job.push_execution_context(self.results_dir)506 try:507 self.host.run(daemon_cmd, ignore_status=True, timeout=timeout)508 disconnect_warnings = []509 while True:510 monitor_cmd = self.get_monitor_cmd(monitor_dir, stdout_read,511 stderr_read)512 try:513 result = self.host.run(monitor_cmd, ignore_status=True,514 timeout=timeout,515 stdout_tee=client_log,516 stderr_tee=stderr_redirector)517 except error.AutoservRunError, e:518 result = e.result_obj519 result.exit_status = None520 disconnect_warnings.append(e.description)521 stderr_redirector.log_warning(522 "Autotest client was disconnected: %s" % e.description,523 "NETWORK")524 except error.AutoservSSHTimeout:525 result = utils.CmdResult(monitor_cmd, "", "", None, 0)526 stderr_redirector.log_warning(527 "Attempt to connect to Autotest client timed out",528 "NETWORK")529 stdout_read += len(result.stdout)530 stderr_read += len(self._strip_stderr_prologue(result.stderr))531 if result.exit_status is not None:532 return result533 elif not self.host.wait_up(client_disconnect_timeout):534 raise error.AutoservSSHTimeout(535 "client was disconnected, reconnect timed out")536 finally:537 client_log.close()538 self.host.job.pop_execution_context()539 def execute_section(self, section, timeout, stderr_redirector,540 client_disconnect_timeout):541 logging.info("Executing %s/bin/autotest %s/control phase %d",542 self.autodir, self.autodir, section)543 if self.background:544 result = self._execute_in_background(section, timeout)545 else:546 result = self._execute_daemon(section, timeout, stderr_redirector,547 client_disconnect_timeout)548 last_line = stderr_redirector.last_line549 # check if we failed hard enough to warrant an exception550 if result.exit_status == 1:551 err = error.AutotestRunError("client job was aborted")552 elif not self.background and not result.stderr:553 err = error.AutotestRunError(554 "execute_section %s failed to return anything\n"555 "stdout:%s\n" % (section, result.stdout))556 else:557 err = None558 # log something if the client failed AND never finished logging559 if err and not self.is_client_job_finished(last_line):560 self.log_unexpected_abort(stderr_redirector)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful