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 e740f564a23cdb8cb8c52aac216b99421a1d977d..d5ad633d8f46033587f3638422fd4da3447562d4 100644 |
| --- a/build/android/pylib/local/device/local_device_gtest_run.py |
| +++ b/build/android/pylib/local/device/local_device_gtest_run.py |
| @@ -16,6 +16,7 @@ from pylib.gtest import gtest_test_instance |
| from pylib.local import local_test_server_spawner |
| from pylib.local.device import local_device_environment |
| from pylib.local.device import local_device_test_run |
| +from pylib.base import base_test_result |
|
jbudorick
2016/03/01 05:05:26
nit: alphabetize
|
| _COMMAND_LINE_FLAGS_SUPPORTED = True |
| @@ -229,7 +230,7 @@ class LocalDeviceGtestRun(local_device_test_run.LocalDeviceTestRun): |
| self._delegate = _ApkDelegate(self._test_instance) |
| elif self._test_instance.exe: |
| self._delegate = _ExeDelegate(self, self._test_instance.exe) |
| - |
| + self._crashes = set() |
| self._servers = collections.defaultdict(list) |
| #override |
| @@ -283,8 +284,19 @@ class LocalDeviceGtestRun(local_device_test_run.LocalDeviceTestRun): |
| #override |
| def _CreateShards(self, tests): |
| + # _crashes are tests that might crash and make the tests in the same shard |
| + # following the crashed testcase not run. |
| + # Thus we need to create separate shards for each crashed testcase, |
| + # so that other tests can be run. |
| device_count = len(self._env.devices) |
| shards = [] |
| + |
| + # Add shards with only one suspect testcase. |
| + shards += [[crash] for crash in self._crashes if crash in tests] |
| + |
| + # Delete suspect testcase from tests. |
| + tests = [test for test in tests if not test in self._crashes] |
| + |
| for i in xrange(0, device_count): |
| unbounded_shard = tests[i::device_count] |
| shards += [unbounded_shard[j:j+_MAX_SHARD_SIZE] |
| @@ -335,9 +347,14 @@ class LocalDeviceGtestRun(local_device_test_run.LocalDeviceTestRun): |
| if not self._test_instance.skip_clear_data: |
| self._delegate.Clear(device) |
| - # Parse the output. |
|
jbudorick
2016/03/01 05:05:26
?
|
| # TODO(jbudorick): Transition test scripts away from parsing stdout. |
| + |
|
jbudorick
2016/03/01 05:05:26
nit: don't add this line
|
| results = self._test_instance.ParseGTestOutput(output) |
| + |
| + # Check whether there are any crashed testcases. |
| + for result in results: |
|
jbudorick
2016/03/01 05:05:26
These three lines can be:
self._crashes.update(
|
| + if result.GetType() == base_test_result.ResultType.CRASH: |
| + self._crashes.add(result.GetName()) |
| return results |
| #override |