OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 __author__ = "raphtee@google.com (Travis Miller)" | 3 __author__ = "raphtee@google.com (Travis Miller)" |
4 | 4 |
5 import unittest, os, tempfile, logging | 5 import unittest, os, tempfile, logging |
6 | 6 |
7 import common | 7 import common |
8 from autotest_lib.server import autotest, utils, hosts, server_job, profilers | 8 from autotest_lib.server import autotest, utils, hosts, server_job, profilers |
9 from autotest_lib.client.bin import sysinfo | 9 from autotest_lib.client.bin import sysinfo |
10 from autotest_lib.client.common_lib import utils as client_utils, packages | 10 from autotest_lib.client.common_lib import utils as client_utils, packages |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 def _expect_failed_run(self, command): | 249 def _expect_failed_run(self, command): |
250 (self.host.run.expect_call(command) | 250 (self.host.run.expect_call(command) |
251 .and_raises(error.AutoservRunError('dummy', object()))) | 251 .and_raises(error.AutoservRunError('dummy', object()))) |
252 | 252 |
253 | 253 |
254 def test_get_installed_autodir(self): | 254 def test_get_installed_autodir(self): |
255 self._stub_get_client_autodir_paths() | 255 self._stub_get_client_autodir_paths() |
256 self.host.get_autodir.expect_call().and_return(None) | 256 self.host.get_autodir.expect_call().and_return(None) |
257 self._expect_failed_run('test -x /some/path/bin/autotest') | 257 self._expect_failed_run('test -x /some/path/bin/autotest') |
258 self.host.run.expect_call('test -x /another/path/bin/autotest') | 258 self.host.run.expect_call('test -x /another/path/bin/autotest') |
259 self.host.run.expect_call('test -w /another/path') | |
260 | 259 |
261 autodir = autotest.Autotest.get_installed_autodir(self.host) | 260 autodir = autotest.Autotest.get_installed_autodir(self.host) |
262 self.assertEquals(autodir, '/another/path') | 261 self.assertEquals(autodir, '/another/path') |
263 | 262 |
264 | 263 |
265 def test_get_install_dir(self): | 264 def test_get_install_dir(self): |
266 self._stub_get_client_autodir_paths() | 265 self._stub_get_client_autodir_paths() |
267 self.host.get_autodir.expect_call().and_return(None) | 266 self.host.get_autodir.expect_call().and_return(None) |
268 self._expect_failed_run('test -x /some/path/bin/autotest') | 267 self._expect_failed_run('test -x /some/path/bin/autotest') |
269 self._expect_failed_run('test -x /another/path/bin/autotest') | 268 self._expect_failed_run('test -x /another/path/bin/autotest') |
270 self._expect_failed_run('mkdir -p /some/path') | 269 self._expect_failed_run('mkdir -p /some/path') |
271 self.host.run.expect_call('mkdir -p /another/path') | 270 self.host.run.expect_call('mkdir -p /another/path') |
272 self.host.run.expect_call('test -w /another/path') | |
273 | 271 |
274 install_dir = autotest.Autotest.get_install_dir(self.host) | 272 install_dir = autotest.Autotest.get_install_dir(self.host) |
275 self.assertEquals(install_dir, '/another/path') | 273 self.assertEquals(install_dir, '/another/path') |
276 | 274 |
277 | 275 |
278 def test_client_logger_process_line_log_copy_collection_failure(self): | 276 def test_client_logger_process_line_log_copy_collection_failure(self): |
279 collector = autotest.log_collector.expect_new(self.host, '', '') | 277 collector = autotest.log_collector.expect_new(self.host, '', '') |
280 logger = autotest.client_logger(self.host, '', '') | 278 logger = autotest.client_logger(self.host, '', '') |
281 collector.collect_client_job_results.expect_call().and_raises( | 279 collector.collect_client_job_results.expect_call().and_raises( |
282 Exception('log copy failure')) | 280 Exception('log copy failure')) |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 | 347 |
350 | 348 |
351 def test_fails_with_exception(self): | 349 def test_fails_with_exception(self): |
352 self.assertEqual(False, self.mixin.run_test('sleeptest')) | 350 self.assertEqual(False, self.mixin.run_test('sleeptest')) |
353 self.assert_("job.run_test('sleeptest')\n" in self.control_file) | 351 self.assert_("job.run_test('sleeptest')\n" in self.control_file) |
354 self.assertEqual(self.mixin, self.host) | 352 self.assertEqual(self.mixin, self.host) |
355 | 353 |
356 | 354 |
357 if __name__ == "__main__": | 355 if __name__ == "__main__": |
358 unittest.main() | 356 unittest.main() |
OLD | NEW |