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 itertools | 5 import itertools |
6 import os | 6 import os |
7 import posixpath | 7 import posixpath |
8 | 8 |
9 from devil.android import device_errors | 9 from devil.android import device_errors |
10 from devil.android import device_temp_file | 10 from devil.android import device_temp_file |
(...skipping 13 matching lines...) Expand all Loading... |
24 _EXTRA_SHARD_NANO_TIMEOUT = ( | 24 _EXTRA_SHARD_NANO_TIMEOUT = ( |
25 'org.chromium.native_test.NativeTestInstrumentationTestRunner' | 25 'org.chromium.native_test.NativeTestInstrumentationTestRunner' |
26 '.ShardNanoTimeout') | 26 '.ShardNanoTimeout') |
27 _EXTRA_TEST_LIST = ( | 27 _EXTRA_TEST_LIST = ( |
28 'org.chromium.native_test.NativeTestInstrumentationTestRunner' | 28 'org.chromium.native_test.NativeTestInstrumentationTestRunner' |
29 '.TestList') | 29 '.TestList') |
30 | 30 |
31 _MAX_SHARD_SIZE = 256 | 31 _MAX_SHARD_SIZE = 256 |
32 _SECONDS_TO_NANOS = int(1e9) | 32 _SECONDS_TO_NANOS = int(1e9) |
33 | 33 |
| 34 # The amount of time a test executable may run before it gets killed. |
| 35 _TEST_TIMEOUT_SECONDS = 30*60 |
| 36 |
34 # TODO(jbudorick): Move this up to the test instance if the net test server is | 37 # TODO(jbudorick): Move this up to the test instance if the net test server is |
35 # handled outside of the APK for the remote_device environment. | 38 # handled outside of the APK for the remote_device environment. |
36 _SUITE_REQUIRES_TEST_SERVER_SPAWNER = [ | 39 _SUITE_REQUIRES_TEST_SERVER_SPAWNER = [ |
37 'components_browsertests', 'content_unittests', 'content_browsertests', | 40 'components_browsertests', 'content_unittests', 'content_browsertests', |
38 'net_unittests', 'unit_tests' | 41 'net_unittests', 'unit_tests' |
39 ] | 42 ] |
40 | 43 |
41 # TODO(jbudorick): Move this inside _ApkDelegate once TestPackageApk is gone. | 44 # TODO(jbudorick): Move this inside _ApkDelegate once TestPackageApk is gone. |
42 def PullAppFilesImpl(device, package, files, directory): | 45 def PullAppFilesImpl(device, package, files, directory): |
43 device_dir = device.GetApplicationDataDirectory(package) | 46 device_dir = device.GetApplicationDataDirectory(package) |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 tests = self._test_instance.FilterTests(tests) | 227 tests = self._test_instance.FilterTests(tests) |
225 return tests | 228 return tests |
226 | 229 |
227 test_lists = self._env.parallel_devices.pMap(list_tests).pGet(None) | 230 test_lists = self._env.parallel_devices.pMap(list_tests).pGet(None) |
228 tests = list(sorted(set().union(*[set(tl) for tl in test_lists if tl]))) | 231 tests = list(sorted(set().union(*[set(tl) for tl in test_lists if tl]))) |
229 return tests | 232 return tests |
230 | 233 |
231 #override | 234 #override |
232 def _RunTest(self, device, test): | 235 def _RunTest(self, device, test): |
233 # Run the test. | 236 # Run the test. |
234 timeout = 900 * self.GetTool(device).GetTimeoutScale() | 237 timeout = _TEST_TIMEOUT_SECONDS * self.GetTool(device).GetTimeoutScale() |
235 output = self._delegate.Run( | 238 output = self._delegate.Run( |
236 test, device, timeout=timeout, retries=0) | 239 test, device, timeout=timeout, retries=0) |
237 for s in self._servers[str(device)]: | 240 for s in self._servers[str(device)]: |
238 s.Reset() | 241 s.Reset() |
239 if self._test_instance.app_files: | 242 if self._test_instance.app_files: |
240 self._delegate.PullAppFiles(device, self._test_instance.app_files, | 243 self._delegate.PullAppFiles(device, self._test_instance.app_files, |
241 self._test_instance.app_file_dir) | 244 self._test_instance.app_file_dir) |
242 self._delegate.Clear(device) | 245 self._delegate.Clear(device) |
243 | 246 |
244 # Parse the output. | 247 # Parse the output. |
245 # TODO(jbudorick): Transition test scripts away from parsing stdout. | 248 # TODO(jbudorick): Transition test scripts away from parsing stdout. |
246 results = self._test_instance.ParseGTestOutput(output) | 249 results = self._test_instance.ParseGTestOutput(output) |
247 return results | 250 return results |
248 | 251 |
249 #override | 252 #override |
250 def TearDown(self): | 253 def TearDown(self): |
251 @local_device_test_run.handle_shard_failures | 254 @local_device_test_run.handle_shard_failures |
252 def individual_device_tear_down(dev): | 255 def individual_device_tear_down(dev): |
253 for s in self._servers.get(str(dev), []): | 256 for s in self._servers.get(str(dev), []): |
254 s.TearDown() | 257 s.TearDown() |
255 | 258 |
256 self._env.parallel_devices.pMap(individual_device_tear_down) | 259 self._env.parallel_devices.pMap(individual_device_tear_down) |
257 | |
OLD | NEW |