Chromium Code Reviews| Index: build/android/pylib/local/device/local_device_gtest_run.py |
| diff --git a/build/android/pylib/local/device/local_device_gtest_run.py b/build/android/pylib/local/device/local_device_gtest_run.py |
| index a8452600791a8c08d80b7af19713bd76d3b0a6b0..7ddbbac7833a59298ff43cca408c4755ba521bbe 100644 |
| --- a/build/android/pylib/local/device/local_device_gtest_run.py |
| +++ b/build/android/pylib/local/device/local_device_gtest_run.py |
| @@ -21,11 +21,15 @@ _EXTRA_COMMAND_LINE_FILE = ( |
| 'org.chromium.native_test.NativeTestActivity.CommandLineFile') |
| _EXTRA_COMMAND_LINE_FLAGS = ( |
| 'org.chromium.native_test.NativeTestActivity.CommandLineFlags') |
| +_EXTRA_SHARD_NANO_TIMEOUT = ( |
| + 'org.chromium.native_test.NativeTestInstrumentationTestRunner' |
| + '.ShardNanoTimeout') |
| _EXTRA_TEST_LIST = ( |
| 'org.chromium.native_test.NativeTestInstrumentationTestRunner' |
| '.TestList') |
| _MAX_SHARD_SIZE = 256 |
| +_SECONDS_TO_NANOS = int(1e9) |
| # TODO(jbudorick): Move this up to the test instance if the net test server is |
| # handled outside of the APK for the remote_device environment. |
| @@ -65,6 +69,14 @@ class _ApkDelegate(object): |
| def Run(self, test, device, flags=None, **kwargs): |
| extras = dict(self._extras) |
| + if 'timeout' in kwargs: |
| + # Make sure the instrumentation doesn't kill the test before the |
| + # scripts do. The provided timeout value is in seconds, but the |
| + # instrumentation deals with nanoseconds because that's how Android |
| + # handles time. |
| + extras[_EXTRA_SHARD_NANO_TIMEOUT] = int( |
|
jbudorick
2015/09/23 20:36:45
kjellander: this is the change that should prevent
|
| + kwargs['timeout'] * _SECONDS_TO_NANOS) |
| + |
| with device_temp_file.DeviceTempFile(device.adb) as command_line_file: |
| device.WriteFile(command_line_file.name, '_ %s' % flags if flags else '_') |
| extras[_EXTRA_COMMAND_LINE_FILE] = command_line_file.name |
| @@ -218,8 +230,12 @@ class LocalDeviceGtestRun(local_device_test_run.LocalDeviceTestRun): |
| #override |
| def _RunTest(self, device, test): |
| - # Run the test. |
| - timeout = 900 * self.GetTool(device).GetTimeoutScale() |
| + if self._test_instance.suite in gtest_test_instance.BROWSER_TEST_SUITES: |
| + timeout = 900 |
| + else: |
| + timeout = 60 |
| + timeout *= self.GetTool(device).GetTimeoutScale() |
| + |
| output = self._delegate.Run( |
| test, device, timeout=timeout, retries=0) |
| for s in self._servers[str(device)]: |
| @@ -229,7 +245,6 @@ class LocalDeviceGtestRun(local_device_test_run.LocalDeviceTestRun): |
| self._test_instance.app_file_dir) |
| self._delegate.Clear(device) |
| - # Parse the output. |
| # TODO(jbudorick): Transition test scripts away from parsing stdout. |
| results = self._test_instance.ParseGTestOutput(output) |
| return results |
| @@ -238,7 +253,7 @@ class LocalDeviceGtestRun(local_device_test_run.LocalDeviceTestRun): |
| def TearDown(self): |
| @local_device_test_run.handle_shard_failures |
| def individual_device_tear_down(dev): |
| - for s in self._servers[str(dev)]: |
| + for s in self._servers.get(str(dev), []): |
| s.TearDown() |
| self._env.parallel_devices.pMap(individual_device_tear_down) |