| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium 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 fnmatch | 5 import fnmatch |
| 6 import imp | 6 import imp |
| 7 import logging | 7 import logging |
| 8 import signal | 8 import signal |
| 9 import thread | 9 import thread |
| 10 import threading | 10 import threading |
| 11 | 11 |
| 12 from devil.utils import signal_handler | 12 from devil.utils import signal_handler |
| 13 from pylib import valgrind_tools | 13 from pylib import valgrind_tools |
| 14 from pylib.base import base_test_result | 14 from pylib.base import base_test_result |
| 15 from pylib.base import test_run | 15 from pylib.base import test_run |
| 16 from pylib.base import test_collection | 16 from pylib.base import test_collection |
| 17 from pylib.local.device import local_device_environment | 17 from pylib.local.device import local_device_environment |
| 18 | 18 |
| 19 | 19 |
| 20 _SIGTERM_TEST_LOG = ( |
| 21 ' Suite execution terminated, probably due to swarming timeout.\n' |
| 22 ' Your test may not have run.') |
| 23 |
| 24 |
| 20 def IncrementalInstall(device, apk_helper, installer_script): | 25 def IncrementalInstall(device, apk_helper, installer_script): |
| 21 """Performs an incremental install. | 26 """Performs an incremental install. |
| 22 | 27 |
| 23 Args: | 28 Args: |
| 24 device: Device to install on. | 29 device: Device to install on. |
| 25 apk_helper: ApkHelper instance for the _incremental.apk. | 30 apk_helper: ApkHelper instance for the _incremental.apk. |
| 26 installer_script: Path to the installer script for the incremental apk. | 31 installer_script: Path to the installer script for the incremental apk. |
| 27 """ | 32 """ |
| 28 try: | 33 try: |
| 29 install_wrapper = imp.load_source('install_wrapper', installer_script) | 34 install_wrapper = imp.load_source('install_wrapper', installer_script) |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 for t in test_names if not t.endswith('*')) | 111 for t in test_names if not t.endswith('*')) |
| 107 | 112 |
| 108 try: | 113 try: |
| 109 if self._ShouldShard(): | 114 if self._ShouldShard(): |
| 110 tc = test_collection.TestCollection(self._CreateShards(tests)) | 115 tc = test_collection.TestCollection(self._CreateShards(tests)) |
| 111 self._env.parallel_devices.pMap( | 116 self._env.parallel_devices.pMap( |
| 112 run_tests_on_device, tc, try_results).pGet(None) | 117 run_tests_on_device, tc, try_results).pGet(None) |
| 113 else: | 118 else: |
| 114 self._env.parallel_devices.pMap( | 119 self._env.parallel_devices.pMap( |
| 115 run_tests_on_device, tests, try_results).pGet(None) | 120 run_tests_on_device, tests, try_results).pGet(None) |
| 121 except TestsTerminated: |
| 122 for unknown_result in try_results.GetUnknown(): |
| 123 try_results.AddResult( |
| 124 base_test_result.BaseTestResult( |
| 125 unknown_result.GetName(), |
| 126 base_test_result.ResultType.TIMEOUT, |
| 127 log=_SIGTERM_TEST_LOG)) |
| 128 raise |
| 116 finally: | 129 finally: |
| 117 results.append(try_results) | 130 results.append(try_results) |
| 118 | 131 |
| 119 tries += 1 | 132 tries += 1 |
| 120 tests = self._GetTestsToRetry(tests, try_results) | 133 tests = self._GetTestsToRetry(tests, try_results) |
| 121 | 134 |
| 122 logging.info('FINISHED TRY #%d/%d', tries, self._env.max_tries) | 135 logging.info('FINISHED TRY #%d/%d', tries, self._env.max_tries) |
| 123 if tests: | 136 if tests: |
| 124 logging.info('%d failed tests remain.', len(tests)) | 137 logging.info('%d failed tests remain.', len(tests)) |
| 125 else: | 138 else: |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 | 187 |
| 175 def _RunTest(self, device, test): | 188 def _RunTest(self, device, test): |
| 176 raise NotImplementedError | 189 raise NotImplementedError |
| 177 | 190 |
| 178 def _ShouldShard(self): | 191 def _ShouldShard(self): |
| 179 raise NotImplementedError | 192 raise NotImplementedError |
| 180 | 193 |
| 181 | 194 |
| 182 class NoTestsError(Exception): | 195 class NoTestsError(Exception): |
| 183 """Error for when no tests are found.""" | 196 """Error for when no tests are found.""" |
| OLD | NEW |