| 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..48941e9223b12dd28940e2bdd5d2bd8f15b17427 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(
|
| + 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
|
| @@ -238,7 +250,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)
|
|
|