| OLD | NEW |
| 1 # Copyright 2007 Google Inc. Released under the GPL v2 | 1 # Copyright 2007 Google Inc. Released under the GPL v2 |
| 2 | 2 |
| 3 import re, os, sys, traceback, subprocess, time, pickle, glob, tempfile | 3 import re, os, sys, traceback, subprocess, time, pickle, glob, tempfile |
| 4 import logging, getpass | 4 import logging, getpass |
| 5 from autotest_lib.server import installable_object, prebuild, utils | 5 from autotest_lib.server import installable_object, prebuild, utils |
| 6 from autotest_lib.client.common_lib import base_job, log, error, autotemp | 6 from autotest_lib.client.common_lib import base_job, log, error, autotemp |
| 7 from autotest_lib.client.common_lib import global_config, packages | 7 from autotest_lib.client.common_lib import global_config, packages |
| 8 from autotest_lib.client.common_lib import utils as client_utils | 8 from autotest_lib.client.common_lib import utils as client_utils |
| 9 | 9 |
| 10 AUTOTEST_SVN = 'svn://test.kernel.org/autotest/trunk/client' | 10 AUTOTEST_SVN = 'svn://test.kernel.org/autotest/trunk/client' |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 """ | 69 """ |
| 70 autodir = host.get_autodir() | 70 autodir = host.get_autodir() |
| 71 if autodir: | 71 if autodir: |
| 72 logging.debug('Using existing host autodir: %s', autodir) | 72 logging.debug('Using existing host autodir: %s', autodir) |
| 73 return autodir | 73 return autodir |
| 74 | 74 |
| 75 for path in Autotest.get_client_autodir_paths(host): | 75 for path in Autotest.get_client_autodir_paths(host): |
| 76 try: | 76 try: |
| 77 autotest_binary = os.path.join(path, 'bin', 'autotest') | 77 autotest_binary = os.path.join(path, 'bin', 'autotest') |
| 78 host.run('test -x %s' % utils.sh_escape(autotest_binary)) | 78 host.run('test -x %s' % utils.sh_escape(autotest_binary)) |
| 79 host.run('test -w %s' % utils.sh_escape(path)) | |
| 80 logging.debug('Found existing autodir at %s', path) | 79 logging.debug('Found existing autodir at %s', path) |
| 81 return path | 80 return path |
| 82 except error.AutoservRunError: | 81 except error.AutoservRunError: |
| 83 logging.debug('%s does not exist on %s', autotest_binary, | 82 logging.debug('%s does not exist on %s', autotest_binary, |
| 84 host.hostname) | 83 host.hostname) |
| 85 raise AutodirNotFoundError | 84 raise AutodirNotFoundError |
| 86 | 85 |
| 87 | 86 |
| 88 @classmethod | 87 @classmethod |
| 89 def get_install_dir(cls, host): | 88 def get_install_dir(cls, host): |
| (...skipping 13 matching lines...) Expand all Loading... |
| 103 return host.get_tmp_dir(parent=install_dir) | 102 return host.get_tmp_dir(parent=install_dir) |
| 104 return install_dir | 103 return install_dir |
| 105 | 104 |
| 106 | 105 |
| 107 @classmethod | 106 @classmethod |
| 108 def _find_installable_dir(cls, host): | 107 def _find_installable_dir(cls, host): |
| 109 client_autodir_paths = cls.get_client_autodir_paths(host) | 108 client_autodir_paths = cls.get_client_autodir_paths(host) |
| 110 for path in client_autodir_paths: | 109 for path in client_autodir_paths: |
| 111 try: | 110 try: |
| 112 host.run('mkdir -p %s' % utils.sh_escape(path)) | 111 host.run('mkdir -p %s' % utils.sh_escape(path)) |
| 113 host.run('test -w %s' % utils.sh_escape(path)) | |
| 114 return path | 112 return path |
| 115 except error.AutoservRunError: | 113 except error.AutoservRunError: |
| 116 logging.debug('Failed to create %s', path) | 114 logging.debug('Failed to create %s', path) |
| 117 raise error.AutoservInstallError( | 115 raise error.AutoservInstallError( |
| 118 'Unable to find a place to install Autotest; tried %s', | 116 'Unable to find a place to install Autotest; tried %s', |
| 119 ', '.join(client_autodir_paths)) | 117 ', '.join(client_autodir_paths)) |
| 120 | 118 |
| 121 | 119 |
| 122 def install(self, host=None, autodir=None): | 120 def install(self, host=None, autodir=None): |
| 123 self._install(host=host, autodir=autodir) | 121 self._install(host=host, autodir=autodir) |
| (...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1068 | 1066 |
| 1069 @returns: True if the test passes, False otherwise.""" | 1067 @returns: True if the test passes, False otherwise.""" |
| 1070 at = self._Autotest() | 1068 at = self._Autotest() |
| 1071 control_file = ('result = job.run_test(%s)\n' | 1069 control_file = ('result = job.run_test(%s)\n' |
| 1072 'job.set_state("test_result", result)\n') | 1070 'job.set_state("test_result", result)\n') |
| 1073 test_args = [repr(test_name)] | 1071 test_args = [repr(test_name)] |
| 1074 test_args += ['%s=%r' % (k, v) for k, v in dargs.iteritems()] | 1072 test_args += ['%s=%r' % (k, v) for k, v in dargs.iteritems()] |
| 1075 control_file %= ', '.join(test_args) | 1073 control_file %= ', '.join(test_args) |
| 1076 at.run(control_file, host=self) | 1074 at.run(control_file, host=self) |
| 1077 return at.job.get_state('test_result', default=False) | 1075 return at.job.get_state('test_result', default=False) |
| OLD | NEW |