Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1373)

Unified Diff: build/android/pylib/local/device/local_device_gtest_run.py

Issue 1703863003: Created separate shards for suspicious testcases. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixes Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..e0c6921e6a3beb53551413a7e5861b910442c7d2 100644
--- a/build/android/pylib/local/device/local_device_gtest_run.py
+++ b/build/android/pylib/local/device/local_device_gtest_run.py
@@ -12,6 +12,7 @@ from devil.android import device_temp_file
from devil.android import ports
from devil.utils import reraiser_thread
from pylib import constants
+from pylib.base import base_test_result
from pylib.gtest import gtest_test_instance
from pylib.local import local_test_server_spawner
from pylib.local.device import local_device_environment
@@ -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]
@@ -338,6 +350,10 @@ class LocalDeviceGtestRun(local_device_test_run.LocalDeviceTestRun):
# Parse the output.
# TODO(jbudorick): Transition test scripts away from parsing stdout.
results = self._test_instance.ParseGTestOutput(output)
+
+ # Check whether there are any crashed testcases.
+ self._crashes.update(r.GetName() for r in results
+ if r.GetType() == base_test_result.ResultType.CRASH)
return results
#override

Powered by Google App Engine
This is Rietveld 408576698