Home | History | Annotate | Download | only in server

Lines Matching refs:host

101     def __init__(self, host=None):
102 self.host = host
119 def get_client_autodir_paths(cls, host):
125 def get_installed_autodir(cls, host):
127 Find where the Autotest client is installed on the host.
131 autodir = host.get_autodir()
133 logging.debug('Using existing host autodir: %s', autodir)
136 for path in Autotest.get_client_autodir_paths(host):
139 host.run('test -x %s' % utils.sh_escape(autotest_binary))
140 host.run('test -w %s' % utils.sh_escape(path))
145 host.hostname)
150 def get_install_dir(cls, host):
153 host. If self.install_in_tmpdir is set, it will return a unique
159 install_dir = cls.get_installed_autodir(host)
161 install_dir = cls._find_installable_dir(host)
164 return host.get_tmp_dir(parent=install_dir)
169 def _find_installable_dir(cls, host):
170 client_autodir_paths = cls.get_client_autodir_paths(host)
173 host.run('mkdir -p %s' % utils.sh_escape(path))
174 host.run('test -w %s' % utils.sh_escape(path))
180 fields={'dut_host_name': host.hostname})
192 from which to source packages when running a test on that host.
209 # set this as the repo_url for the host. If an AFE is not being
213 # the host will no longer have the context of the image option
216 # devserver selected must be in the same subnet of self.host, if
217 # the host is in restricted subnet. Otherwise, host may not be
220 hostname = self.host.hostname if self.host else None
226 # Only try to get fetch location from host attribute if the test
229 # the host attribute. If we are not running with a full AFE
232 # artifacts for the build on the host.
244 """Get repo to use for packages from host attribute, if possible.
247 from which to source packages when running a test on that host.
248 If self.host is set, attempt to look this attribute in the host info.
250 @returns value of the 'job_repo_url' host attribute, if present.
252 if not self.host:
256 info = self.host.host_info_store.get()
262 # - This pulls in all the host classes ever defined
264 logging.warning('Failed to obtain host info: %r', e)
271 logging.warning("No %s for %s", JOB_REPO_URL, self.host)
274 logging.info('Got job repo url from host attributes: %s',
279 def install(self, host=None, autodir=None, use_packaging=True):
280 """Install autotest. If |host| is not None, stores it in |self.host|.
282 @param host A Host instance on which autotest will be installed
283 @param autodir Location on the remote host to install to
287 if host:
288 self.host = host
289 self._install(host=host, autodir=autodir, use_packaging=use_packaging)
292 def install_full_client(self, host=None, autodir=None):
293 self._install(host=host, autodir=autodir, use_autoserv=False,
297 def install_no_autoserv(self, host=None, autodir=None):
298 self._install(host=host, autodir=autodir, use_autoserv=False)
301 def _install_using_packaging(self, host, autodir):
306 pkgmgr = packages.PackageManager(autodir, hostname=host.hostname,
309 run_function=host.run,
317 host.run('cd %s && ls | grep -v "^packages$" | grep -v "^result_tools$"'
324 def _install_using_send_file(self, host, autodir):
330 host.send_file(light_files, autodir, delete_dest=True)
339 host.run(';'.join(commands))
342 def _install(self, host=None, autodir=None, use_autoserv=True,
349 @param host A Host instance on which autotest will be installed
350 @param autodir Location on the remote host to install to
356 the target host does not have svn installed in its path
358 if not host:
359 host = self.host
362 host.wait_up(timeout=30)
363 host.setup()
364 logging.info("Installing autotest on %s", host.hostname)
368 autodir = self.get_install_dir(host)
370 host.set_autodir(autodir)
371 host.run('mkdir -p %s' % utils.sh_escape(autodir))
375 host.run('rm -rf %s/*' % utils.sh_escape(results_path),
381 self._install_using_packaging(host, autodir)
394 host.run(command)
403 host, autodir)
405 host.send_file(self.source_material, autodir, delete_dest=True)
414 host.hostname)
416 host.run('svn checkout %s %s' % (AUTOTEST_SVN, autodir))
418 host.run('svn checkout %s %s' % (AUTOTEST_HTTP, autodir))
432 destination = os.path.join(self.host.get_autodir(),
439 self.host.send_file(client_config.name, destination)
442 def uninstall(self, host=None):
445 from the specified host.
447 @params host a Host instance from which the client will be removed
451 if not host:
452 host = self.host
453 autodir = host.get_autodir()
458 host.run("rm -rf %s" % utils.sh_escape(autodir), ignore_status=True)
459 host.set_autodir(None)
471 def run(self, control_file, results_dir='.', host=None, timeout=None,
480 @param host: A Host instance on which the control file should
489 @param client_disconnect_timeout: Seconds to wait for the remote host
490 to come back after a reboot. Defaults to the host setting for
496 host = self._get_host_and_setup(host, use_packaging=use_packaging)
497 logging.debug('Autotest job starts on remote host: %s',
498 host.hostname)
502 client_disconnect_timeout = host.DEFAULT_REBOOT_TIMEOUT
507 atrun = _Run(host, results_dir, tag, parallel_flag, background)
508 self._do_run(control_file, results_dir, host, atrun, timeout,
512 def _get_host_and_setup(self, host, use_packaging=True):
513 if not host:
514 host = self.host
516 self.install(host, use_packaging=use_packaging)
518 host.wait_up(timeout=30)
519 return host
522 def _do_run(self, control_file, results_dir, host, atrun, timeout,
528 host.hostname)
529 self.install(host)
542 host.run(cmd, ignore_status=True)
568 running_profilers = host.job.profilers.add_log.iteritems()
581 state_file = host.job.preprocess_client_state()
582 host.send_file(state_file, atrun.remote_control_file + '.init.state')
585 # Copy control_file to remote_control_file on the host
586 host.send_file(tmppath, atrun.remote_control_file)
614 def _check_client_test_result(cls, host, test_name):
622 client_result_dir = '%s/results/default' % host.autodir
624 status = host.run(command).stdout.strip()
631 host.run(test_fail_status_line_cmd).stdout.strip())
639 def run_timed_test(self, test_name, results_dir='.', host=None,
646 if not host:
647 host = self.host
649 self.install(host)
653 self.run(control, results_dir, host, timeout=timeout,
658 self._check_client_test_result(host, test_name)
661 def run_test(self, test_name, results_dir='.', host=None,
664 self.run_timed_test(test_name, results_dir, host, timeout=None,
670 def run_static_method(self, module, method, results_dir='.', host=None,
685 @param host: A Host instance on which the control file should
692 self.run(control, results_dir=results_dir, host=host)
703 def __init__(self, host, results_dir, tag, parallel_flag, background):
704 self.host = host
706 self.env = host.env
710 self.autodir = Autotest.get_installed_autodir(self.host)
722 self.host.run('ls %s > /dev/null 2>&1' % binary)
730 self.host.run('umount %s' % tmpdir, ignore_status=True)
731 self.host.run('umount %s' % download, ignore_status=True)
740 if self.host.job.use_external_logging():
742 if self.host.hostname:
743 args.append('--hostname=%s' % self.host.hostname)
744 args.append('--user=%s' % self.host.job.user)
794 self.host.send_file(client_config_file, self.config_file)
824 fd, path = tempfile.mkstemp(dir=self.host.job.tmpdir)
849 1. ping: A dead host will not respond to pings.
853 host running with a new boot id.
866 if utils.ping(self.host.hostname, tries=1, deadline=1) != 0:
872 new_boot_id = self.host.get_boot_id(timeout=60)
906 self.host.job.record('END ABORT', None, None, str(e))
915 self.host.job.push_execution_context(self.results_dir)
917 result = self.host.run(full_cmd, ignore_status=True,
922 self.host.job.pop_execution_context()
942 monitor_dir = self.host.get_tmp_dir()
953 self.host.job.push_execution_context(self.results_dir)
955 self.host.run(daemon_cmd, ignore_status=True, timeout=timeout)
961 result = self.host.run(monitor_cmd, ignore_status=True,
987 elif not self.host.wait_up(client_disconnect_timeout):
992 self.host.job.pop_execution_context()
1036 if not self.host.wait_down(self.host.WAIT_DOWN_REBOOT_TIMEOUT,
1039 err %= (self.host.hostname, self.host.WAIT_DOWN_REBOOT_TIMEOUT)
1042 if not self.host.wait_up(self.host.DEFAULT_REBOOT_TIMEOUT):
1047 warning %= self.host.hostname
1050 self.host.hardreset(wait=False)
1053 warning %= self.host.hostname
1056 (self.host.hostname,
1057 self.host.DEFAULT_REBOOT_TIMEOUT))
1058 self.host.reboot_followup()
1063 collector = log_collector(self.host, self.tag, self.results_dir)
1064 hostname = self.host.hostname
1067 self.host.job.add_client_log(hostname, remote_results,
1069 job_record_context = self.host.job.get_record_context()
1074 logger = client_logger(self.host, self.tag, self.results_dir)
1081 boot_id = self.host.get_boot_id()
1094 self.host.job.record("ABORT", None, "reboot", str(e))
1095 self.host.job.record("END ABORT", None, None, str(e))
1115 self.host.job.record('FAIL', None, None, str(e))
1116 self.host.job.record('END FAIL', None, None)
1117 self.host.job.record('END GOOD', None, None)
1118 self.host.job.failed_with_device_error = True
1121 self.host.job.record('ABORT', None, None, str(e))
1122 self.host.job.record('END ABORT', None, None)
1125 self.host.wait_up(
1126 self.host.HOURS_TO_WAIT_FOR_RECOVERY * 3600)
1128 'client %s: %s', self.host.hostname, last)
1134 "client on %s\n") % self.host.hostname
1146 self.host.job.postprocess_client_state(state_path)
1147 self.host.job.remove_client_log(hostname, remote_results,
1159 def __init__(self, host, client_tag, results_dir):
1160 self.host = host
1163 self.client_results_dir = os.path.join(host.get_autodir(), "results",
1175 self.host.wait_up(timeout=30)
1185 self.host, self.client_results_dir)
1189 fields={'dut_host_name': self.host.hostname}):
1190 self.host.get_file(
1227 def __init__(self, host, tag, server_results_dir):
1228 self.host = host
1229 self.job = host.job
1230 self.log_collector = log_collector(host, tag, server_results_dir)
1321 self.host.send_file(checksum_file, dest_path)
1330 self.host.run("echo B > %s" % fifo_path)
1349 self.host.run("echo A > %s" % fifo_path)
1364 self.host.run("echo B > %s" % fifo_path)
1378 self.host.send_file(server_package, remote_dest)
1412 self.host.send_file(tarball_path, remote_dest)