Lines Matching +full:- +full:- +full:host
3 #pylint: disable-msg=C0111
53 r'\s*FAIL.*localtime=.*\s*.*\s*[0-9]+:[0-9]+:[0-9]+\s*(?P<fail_msg>.*)')
60 return '--py_version=3'
113 def __init__(self, host=None): argument
114 self.host = host
131 def get_client_autodir_paths(cls, host): argument
137 def get_installed_autodir(cls, host): argument
139 Find where the Autotest client is installed on the host.
143 autodir = host.get_autodir()
145 logging.debug('Using existing host autodir: %s', autodir)
148 for path in Autotest.get_client_autodir_paths(host):
151 host.run('test -x %s' % utils.sh_escape(autotest_binary))
152 host.run('test -w %s' % utils.sh_escape(path))
157 host.hostname)
162 def get_install_dir(cls, host): argument
165 host. If self.install_in_tmpdir is set, it will return a unique
171 install_dir = cls.get_installed_autodir(host)
173 install_dir = cls._find_installable_dir(host)
176 return host.get_tmp_dir(parent=install_dir)
181 def _find_installable_dir(cls, host): argument
182 client_autodir_paths = cls.get_client_autodir_paths(host)
185 host.run('mkdir -p %s' % utils.sh_escape(path))
186 host.run('test -w %s' % utils.sh_escape(path))
192 fields={'dut_host_name': host.hostname})
202 to source packages when running a test on that host.
212 # Only try to get fetch location from host attribute if the
215 # Look for the repo url via the host attribute. If we are
219 # build on the host.
231 """Get repo to use for packages from host attribute, if possible.
234 from which to source packages when running a test on that host.
235 If self.host is set, attempt to look this attribute in the host info.
237 @returns value of the 'job_repo_url' host attribute, if present.
239 if not self.host:
243 info = self.host.host_info_store.get()
247 # - autotest_lib.hosts.host_info pulls in (naturally)
249 # - This pulls in all the host classes ever defined
250 # - That includes abstract_ssh, which depends on autotest
251 logging.warning('Failed to obtain host info: %r', e)
258 logging.warning("No %s for %s", JOB_REPO_URL, self.host)
261 logging.info('Got job repo url from host attributes: %s',
266 def install(self, host=None, autodir=None, use_packaging=True): argument
267 """Install autotest. If |host| is not None, stores it in |self.host|.
269 @param host A Host instance on which autotest will be installed
270 @param autodir Location on the remote host to install to
274 if host:
275 self.host = host
276 self._install(host=host, autodir=autodir, use_packaging=use_packaging)
279 def install_full_client(self, host=None, autodir=None): argument
280 self._install(host=host, autodir=autodir, use_autoserv=False,
284 def install_no_autoserv(self, host=None, autodir=None): argument
285 self._install(host=host, autodir=autodir, use_autoserv=False)
288 def _install_using_packaging(self, host, autodir): argument
294 host.verify_job_repo_url()
295 pkgmgr = packages.PackageManager(autodir, hostname=host.hostname,
298 run_function=host.run,
306 host.run('cd %s && ls | grep -v "^packages$" | grep -v "^result_tools$"'
307 ' | xargs rm -rf && rm -rf .[!.]*' % autodir)
313 def _install_using_send_file(self, host, autodir): argument
319 host.send_file(light_files, autodir, delete_dest=True)
326 commands.append("mkdir -p '%s'" % abs_path)
328 host.run(';'.join(commands))
331 def _install(self, host=None, autodir=None, use_autoserv=True, argument
338 @param host A Host instance on which autotest will be installed
339 @param autodir Location on the remote host to install to
345 the target host does not have svn installed in its path
347 if not host:
348 host = self.host
351 host.wait_up(timeout=30)
352 host.setup()
355 logging.info("Installing autotest on %s", host.hostname)
359 autodir = self.get_install_dir(host)
361 host.set_autodir(autodir)
362 host.run('mkdir -p %s' % utils.sh_escape(autodir))
366 host.run('rm -rf %s/*' % utils.sh_escape(results_path),
372 self._install_using_packaging(host, autodir)
383 command = ('rm -f "%s"' %
385 host.run(command)
394 self._install_using_send_file(host, autodir)
396 host.send_file(self.source_material, autodir, delete_dest=True)
405 host.hostname)
407 host.run('svn checkout %s %s' % (AUTOTEST_SVN, autodir))
409 host.run('svn checkout %s %s' % (AUTOTEST_HTTP, autodir))
421 # sync the disk, to avoid getting 0-byte files if a test resets the DUT
422 host.run(os.path.join(autodir, 'bin', 'fs_sync.py'),
427 destination = os.path.join(self.host.get_autodir(),
434 self.host.send_file(client_config.name, destination)
437 def uninstall(self, host=None): argument
440 from the specified host.
442 @params host a Host instance from which the client will be removed
446 if not host:
447 host = self.host
448 autodir = host.get_autodir()
453 host.run("rm -rf %s" % utils.sh_escape(autodir), ignore_status=True)
454 host.set_autodir(None)
466 def run(self, control_file, results_dir='.', host=None, timeout=None, argument
472 @param control_file: An open file-like-obj of the control file.
475 @param host: A Host instance on which the control file should
484 @param client_disconnect_timeout: Seconds to wait for the remote host
485 to come back after a reboot. Defaults to the host setting for
491 host = self._get_host_and_setup(host, use_packaging=use_packaging)
492 logging.debug('Autotest job starts on remote host: %s',
493 host.hostname)
497 client_disconnect_timeout = host.DEFAULT_REBOOT_TIMEOUT
502 atrun = _Run(host, results_dir, tag, parallel_flag, background)
503 self._do_run(control_file, results_dir, host, atrun, timeout,
507 def _get_host_and_setup(self, host, use_packaging=True): argument
508 if not host:
509 host = self.host
511 self.install(host, use_packaging=use_packaging)
513 host.wait_up(timeout=30)
514 return host
517 def _do_run(self, control_file, results_dir, host, atrun, timeout, argument
523 host.hostname)
524 self.install(host)
536 cmd = ';'.join('rm -f ' + control for control in delete_file_list)
537 host.run(cmd, ignore_status=True)
561 # on full-size installs, turn on any profilers the server is using
563 running_profilers = six.iteritems(host.job.profilers.add_log)
576 state_file = host.job.preprocess_client_state()
577 host.send_file(state_file, atrun.remote_control_file + '.init.state')
580 # Copy control_file to remote_control_file on the host
581 host.send_file(tmppath, atrun.remote_control_file)
609 def _check_client_test_result(cls, host, test_name): argument
617 client_result_dir = '%s/results/default' % host.autodir
618 command = 'tail -2 %s/status | head -1' % client_result_dir
619 status = host.run(command).stdout.strip()
623 'grep "^\s*FAIL\s*%s" %s/status | tail -n 1' %
626 host.run(test_fail_status_line_cmd).stdout.strip())
634 def run_timed_test(self, test_name, results_dir='.', host=None, argument
639 and run it as an autotest client-side test
641 if not host:
642 host = self.host
644 self.install(host)
649 self.run(control, results_dir, host, timeout=timeout,
654 self._check_client_test_result(host, test_name)
660 host=None, argument
670 host,
679 def run_static_method(self, module, method, results_dir='.', host=None, argument
681 """Runs a non-instance method with |args| from |module| on the client.
694 @param host: A Host instance on which the control file should
701 self.run(control, results_dir=results_dir, host=host)
712 def __init__(self, host, results_dir, tag, parallel_flag, background): argument
713 self.host = host
718 self.autodir = Autotest.get_installed_autodir(self.host)
729 at_check = "test -e {} && echo True || echo False".format(binary)
735 if "False" in str(self.host.run(at_check, ignore_status=True).stdout):
742 args = ['--verbose']
744 args.append('-c')
746 args.append('-t %s' % self.tag)
747 if self.host.job.use_external_logging():
748 args.append('-l')
749 if self.host.hostname:
750 args.append('--hostname=%s' % self.host.hostname)
751 args.append('--user=%s' % self.host.job.user)
772 '-H autoserv',
797 max_digit = -1
814 self.host.send_file(client_config_file, self.config_file)
844 fd, path = tempfile.mkstemp(dir=self.host.job.tmpdir)
857 return bool(re.match(r'^\t*END .*\t[\w.-]+\t[\w.-]+\t.*$', last_line))
862 return bool(re.match(r'^\t*GOOD\t[\w.-]+\treboot\.start.*$', last_line))
879 ('Kernel panic - not syncing: Out of memory', 'kernel out of memory'),
880 ('Kernel panic - not syncing', 'kernel panic'),
902 # Use -a option for grep to avoid "binary file" warning to stdout.
903 # The grep -v is added to not match itself in the log (across jobs).
908 found = self.host.run(
909 "grep -aE '" + message + "' /var/log/messages | grep -av grep",
925 1. ping: A dead host will not respond to pings.
929 host running with a new boot id.
942 if utils.ping(self.host.hostname, tries=1, deadline=1) != 0:
948 new_boot_id = self.host.get_boot_id(timeout=60)
959 'un-expectedly. We probably lost connectivity during the '
962 msg += ('DUT is pingable, could not determine if an un-expected '
982 self.host.job.record('END ABORT', None, None, str(e))
991 self.host.job.push_execution_context(self.results_dir)
993 result = self.host.run(full_cmd, ignore_status=True,
998 self.host.job.pop_execution_context()
1005 """Strips the 'standard' prologue that get pre-pended to every
1044 monitor_dir = self.host.get_tmp_dir()
1047 # grab the location for the server-side client log file
1055 self.host.job.push_execution_context(self.results_dir)
1057 self.host.run(daemon_cmd, ignore_status=True, timeout=timeout)
1063 result = self.host.run(monitor_cmd, ignore_status=True,
1087 # TODO (crosbug.com/38224)- sbasi: Remove extra logging.
1091 elif not self.host.wait_up(client_disconnect_timeout):
1096 self.host.job.pop_execution_context()
1140 if not self.host.wait_down(self.host.WAIT_DOWN_REBOOT_TIMEOUT,
1143 err %= (self.host.hostname, self.host.WAIT_DOWN_REBOOT_TIMEOUT)
1146 if not self.host.wait_up(self.host.DEFAULT_REBOOT_TIMEOUT):
1151 warning %= self.host.hostname
1154 self.host.hardreset(wait=False)
1157 warning %= self.host.hostname
1160 (self.host.hostname,
1161 self.host.DEFAULT_REBOOT_TIMEOUT))
1162 self.host.reboot_followup()
1167 collector = log_collector(self.host, self.tag, self.results_dir)
1168 hostname = self.host.hostname
1171 self.host.job.add_client_log(hostname, remote_results,
1173 job_record_context = self.host.job.get_record_context()
1178 logger = client_logger(self.host, self.tag, self.results_dir)
1182 section_timeout = start_time + timeout - time.time()
1185 boot_id = self.host.get_boot_id()
1199 self.host.job.record("ABORT", None, "reboot", str(e))
1200 self.host.job.record("END ABORT", None, None, str(e))
1220 self.host.job.record('FAIL', None, None, str(e))
1221 self.host.job.record('END FAIL', None, None)
1222 self.host.job.record('END GOOD', None, None)
1223 self.host.job.failed_with_device_error = True
1226 self.host.job.record('ABORT', None, None, str(e))
1227 self.host.job.record('END ABORT', None, None)
1230 self.host.wait_up(
1231 self.host.HOURS_TO_WAIT_FOR_RECOVERY * 3600)
1233 'client %s: %s', self.host.hostname, last)
1238 msg = ("Aborting - unexpected final status message from "
1239 "client on %s\n") % self.host.hostname
1245 'post-processing operations.')
1253 self.host.job.postprocess_client_state(state_path)
1254 self.host.job.remove_client_log(hostname, remote_results,
1266 def __init__(self, host, client_tag, results_dir): argument
1267 self.host = host
1270 self.client_results_dir = os.path.join(host.get_autodir(), "results",
1282 self.host.wait_up(timeout=30)
1292 self.host, self.client_results_dir)
1296 fields={'dut_host_name': self.host.hostname}):
1297 self.host.get_file(
1320 # a file-like object for catching stderr from an autotest client and
1334 def __init__(self, host, tag, server_results_dir): argument
1335 self.host = host
1336 self.job = host.job
1337 self.log_collector = log_collector(host, tag, server_results_dir)
1367 self.last_line = log_list[-1].render()
1395 match = re.search(r"^\t*INFO\t----\t----(.*)\t[^\t]*$", line)
1428 self.host.send_file(checksum_file, dest_path)
1437 self.host.run("echo B > %s" % fifo_path)
1456 self.host.run("echo A > %s" % fifo_path)
1458 msg = "Post-test log collection failed, continuing anyway"
1471 self.host.run("echo B > %s" % fifo_path)
1485 self.host.send_file(server_package, remote_dest)
1515 temp_dir = autotemp.tempdir(unique_id='autoserv-packager',
1519 self.host.send_file(tarball_path, remote_dest)
1540 for line in lines[:-1]: