OLD | NEW |
1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import os | 5 import os |
6 | 6 from datetime import datetime |
7 from autotest_lib.client.bin import boottool, site_logging, utils | 7 from autotest_lib.client.bin import boottool, utils |
8 from autotest_lib.client.bin.job import base_client_job | 8 from autotest_lib.client.bin.job import base_client_job |
9 from autotest_lib.client.common_lib import error | 9 from autotest_lib.client.common_lib import error |
10 from datetime import datetime | 10 from autotest_lib.client.cros import cros_logging |
| 11 |
11 | 12 |
12 LAST_BOOT_TAG = object() | 13 LAST_BOOT_TAG = object() |
13 | 14 |
14 class site_job(base_client_job): | 15 class site_job(base_client_job): |
| 16 |
| 17 |
15 def __init__(self, *args, **kwargs): | 18 def __init__(self, *args, **kwargs): |
16 base_client_job.__init__(self, *args, **kwargs) | 19 base_client_job.__init__(self, *args, **kwargs) |
17 | 20 |
| 21 |
18 def _runtest(self, url, tag, args, dargs): | 22 def _runtest(self, url, tag, args, dargs): |
19 # this replaced base_client_job._runtest, which is called by | 23 # this replaced base_client_job._runtest, which is called by |
20 # base_client_job.runtest.group_func (see job.py) | 24 # base_client_job.runtest.group_func (see job.py) |
21 try: | 25 try: |
22 self.last_error = None | 26 self.last_error = None |
23 base_client_job._runtest(self, url, tag, args, dargs) | 27 base_client_job._runtest(self, url, tag, args, dargs) |
24 except error.TestBaseException, detail: | 28 except error.TestBaseException, detail: |
25 self.last_error = detail | 29 self.last_error = detail |
26 raise | 30 raise |
27 | 31 |
| 32 |
28 def run_test(self, url, *args, **dargs): | 33 def run_test(self, url, *args, **dargs): |
29 log_pauser = site_logging.LogRotationPauser() | 34 log_pauser = cros_logging.LogRotationPauser() |
30 passed = False | 35 passed = False |
31 try: | 36 try: |
32 log_pauser.begin() | 37 log_pauser.begin() |
33 passed = base_client_job.run_test(self, url, *args, **dargs) | 38 passed = base_client_job.run_test(self, url, *args, **dargs) |
34 if not passed: | 39 if not passed: |
35 # Save the VM state immediately after the test failure. | 40 # Save the VM state immediately after the test failure. |
36 # This is a NOOP if the the test isn't running in a VM or | 41 # This is a NOOP if the the test isn't running in a VM or |
37 # if the VM is not properly configured to save state. | 42 # if the VM is not properly configured to save state. |
38 group, testname = self.pkgmgr.get_package_name(url, 'test') | 43 group, testname = self.pkgmgr.get_package_name(url, 'test') |
39 now = datetime.now().strftime('%I:%M:%S.%f') | 44 now = datetime.now().strftime('%I:%M:%S.%f') |
(...skipping 15 matching lines...) Expand all Loading... |
55 | 60 |
56 # sync first, so that a sync during shutdown doesn't time out | 61 # sync first, so that a sync during shutdown doesn't time out |
57 utils.system("sync; sync", ignore_status=True) | 62 utils.system("sync; sync", ignore_status=True) |
58 | 63 |
59 utils.system("(sleep 5; reboot) </dev/null >/dev/null 2>&1 &") | 64 utils.system("(sleep 5; reboot) </dev/null >/dev/null 2>&1 &") |
60 self.quit() | 65 self.quit() |
61 | 66 |
62 | 67 |
63 def require_gcc(self): | 68 def require_gcc(self): |
64 return False | 69 return False |
OLD | NEW |