| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 logging | 5 import logging |
| 6 import os | 6 import os |
| 7 import posixpath | 7 import posixpath |
| 8 import re | 8 import re |
| 9 import time | 9 import time |
| 10 | 10 |
| 11 from devil.android import device_errors | 11 from devil.android import device_errors |
| 12 from devil.android import flag_changer | 12 from devil.android import flag_changer |
| 13 from devil.utils import reraiser_thread | 13 from devil.utils import reraiser_thread |
| 14 from pylib import valgrind_tools | 14 from pylib import valgrind_tools |
| 15 from pylib.base import base_test_result | 15 from pylib.base import base_test_result |
| 16 from pylib.local.device import local_device_environment |
| 16 from pylib.local.device import local_device_test_run | 17 from pylib.local.device import local_device_test_run |
| 17 | 18 |
| 18 | 19 |
| 19 TIMEOUT_ANNOTATIONS = [ | 20 TIMEOUT_ANNOTATIONS = [ |
| 20 ('Manual', 10 * 60 * 60), | 21 ('Manual', 10 * 60 * 60), |
| 21 ('IntegrationTest', 30 * 60), | 22 ('IntegrationTest', 30 * 60), |
| 22 ('External', 10 * 60), | 23 ('External', 10 * 60), |
| 23 ('EnormousTest', 10 * 60), | 24 ('EnormousTest', 10 * 60), |
| 24 ('LargeTest', 5 * 60), | 25 ('LargeTest', 5 * 60), |
| 25 ('MediumTest', 3 * 60), | 26 ('MediumTest', 3 * 60), |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 | 61 |
| 61 def SetUp(self): | 62 def SetUp(self): |
| 62 def substitute_device_root(d, device_root): | 63 def substitute_device_root(d, device_root): |
| 63 if not d: | 64 if not d: |
| 64 return device_root | 65 return device_root |
| 65 elif isinstance(d, list): | 66 elif isinstance(d, list): |
| 66 return posixpath.join(p if p else device_root for p in d) | 67 return posixpath.join(p if p else device_root for p in d) |
| 67 else: | 68 else: |
| 68 return d | 69 return d |
| 69 | 70 |
| 70 @local_device_test_run.handle_shard_failures_with( | 71 @local_device_environment.handle_shard_failures_with( |
| 71 self._env.BlacklistDevice) | 72 self._env.BlacklistDevice) |
| 72 def individual_device_set_up(dev, host_device_tuples): | 73 def individual_device_set_up(dev, host_device_tuples): |
| 73 def install_apk(): | 74 def install_apk(): |
| 74 if self._test_instance.apk_under_test: | 75 if self._test_instance.apk_under_test: |
| 75 if self._test_instance.apk_under_test_incremental_install_script: | 76 if self._test_instance.apk_under_test_incremental_install_script: |
| 76 local_device_test_run.IncrementalInstall( | 77 local_device_test_run.IncrementalInstall( |
| 77 dev, | 78 dev, |
| 78 self._test_instance.apk_under_test, | 79 self._test_instance.apk_under_test, |
| 79 self._test_instance.apk_under_test_incremental_install_script) | 80 self._test_instance.apk_under_test_incremental_install_script) |
| 80 else: | 81 else: |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 reraiser_thread.RunAsync(steps) | 142 reraiser_thread.RunAsync(steps) |
| 142 else: | 143 else: |
| 143 for step in steps: | 144 for step in steps: |
| 144 step() | 145 step() |
| 145 | 146 |
| 146 self._env.parallel_devices.pMap( | 147 self._env.parallel_devices.pMap( |
| 147 individual_device_set_up, | 148 individual_device_set_up, |
| 148 self._test_instance.GetDataDependencies()) | 149 self._test_instance.GetDataDependencies()) |
| 149 | 150 |
| 150 def TearDown(self): | 151 def TearDown(self): |
| 151 @local_device_test_run.handle_shard_failures_with( | 152 @local_device_environment.handle_shard_failures_with( |
| 152 self._env.BlacklistDevice) | 153 self._env.BlacklistDevice) |
| 153 def individual_device_tear_down(dev): | 154 def individual_device_tear_down(dev): |
| 154 if str(dev) in self._flag_changers: | 155 if str(dev) in self._flag_changers: |
| 155 self._flag_changers[str(dev)].Restore() | 156 self._flag_changers[str(dev)].Restore() |
| 156 | 157 |
| 157 # Remove package-specific configuration | 158 # Remove package-specific configuration |
| 158 dev.RunShellCommand(['am', 'clear-debug-app'], check_return=True) | 159 dev.RunShellCommand(['am', 'clear-debug-app'], check_return=True) |
| 159 | 160 |
| 160 valgrind_tools.SetChromeTimeoutScale(dev, None) | 161 valgrind_tools.SetChromeTimeoutScale(dev, None) |
| 161 | 162 |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 timeout = v | 361 timeout = v |
| 361 break | 362 break |
| 362 else: | 363 else: |
| 363 logging.warning('Using default 1 minute timeout for %s', test_name) | 364 logging.warning('Using default 1 minute timeout for %s', test_name) |
| 364 timeout = 60 | 365 timeout = 60 |
| 365 | 366 |
| 366 timeout *= cls._GetTimeoutScaleFromAnnotations(annotations) | 367 timeout *= cls._GetTimeoutScaleFromAnnotations(annotations) |
| 367 | 368 |
| 368 return timeout | 369 return timeout |
| 369 | 370 |
| OLD | NEW |