Commit a1ff9217 authored by Ben Joyce's avatar Ben Joyce Committed by Commit Bot

Turn on shards for junit tests.

Ran check on flakiness dashboard which shows no failures on experimental
sharded runner that were not also on regular runner.

https://test-results.appspot.com/dashboards/flakiness_dashboard.html#testType=chrome_junit_tests_with_shards&result=crash&builder=chromium.android%3Aandroid-marshmallow-arm64-rel

Bug: 113506
Change-Id: I3bf8e31c7db36f1be5090ea46627233087f09cc5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2528178
Commit-Queue: benjamin joyce <bjoyce@chromium.org>
Reviewed-by: default avatarAndrew Grieve <agrieve@chromium.org>
Reviewed-by: default avatarPeter Wen <wnwen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#828410}
parent 98becf3a
...@@ -27,6 +27,18 @@ from py_utils import tempfile_ext ...@@ -27,6 +27,18 @@ from py_utils import tempfile_ext
_EXCLUDED_CLASSES_PREFIXES = ('android', 'junit', 'org/bouncycastle/util', _EXCLUDED_CLASSES_PREFIXES = ('android', 'junit', 'org/bouncycastle/util',
'org/hamcrest', 'org/junit', 'org/mockito') 'org/hamcrest', 'org/junit', 'org/mockito')
# Suites we shouldn't shard, usually because they don't contain enough test
# cases. Some suites have poorly formed tests that rely on setup in other
# tests.
_EXCLUDED_SUITES = {
# Too small to shard test suites.
'password_check_junit_tests',
'touch_to_fill_junit_tests',
# Poorly formed test suites.
# TODO: (crbug.com/1147740) Remove component_junit_tests when it's fixed.
'components_junit_tests'
}
# Running time for chrome_junit_tests locally: # Running time for chrome_junit_tests locally:
# 1 shard: 3 min 15 sec, 4 shards: 1 min 29 sec, # 1 shard: 3 min 15 sec, 4 shards: 1 min 29 sec,
# 6 shards: 1 min 10 sec, 8 shards 1 min 6 sec, # 6 shards: 1 min 10 sec, 8 shards 1 min 6 sec,
...@@ -118,13 +130,15 @@ class LocalMachineJunitTestRun(test_run.TestRun): ...@@ -118,13 +130,15 @@ class LocalMachineJunitTestRun(test_run.TestRun):
# This avoids searching through the classparth jars for tests classes, # This avoids searching through the classparth jars for tests classes,
# which takes about 1-2 seconds. # which takes about 1-2 seconds.
if self._test_instance.shards == 1 or self._test_instance.test_filter: if (self._test_instance.shards == 1 or self._test_instance.test_filter
or self._test_instance.suite in _EXCLUDED_SUITES):
test_classes = [] test_classes = []
shards = 1 shards = 1
else: else:
test_classes = _GetTestClasses(wrapper_path) test_classes = _GetTestClasses(wrapper_path)
shards = ChooseNumOfShards(test_classes, self._test_instance.shards) shards = ChooseNumOfShards(test_classes, self._test_instance.shards)
logging.info('Running tests on %d shard(s).', shards)
group_test_list = GroupTestsForShard(shards, test_classes) group_test_list = GroupTestsForShard(shards, test_classes)
with tempfile_ext.NamedTemporaryDirectory() as temp_dir: with tempfile_ext.NamedTemporaryDirectory() as temp_dir:
......
...@@ -656,7 +656,7 @@ def AddJUnitTestOptions(parser): ...@@ -656,7 +656,7 @@ def AddJUnitTestOptions(parser):
help='Filters tests by runner class. Must be fully qualified.') help='Filters tests by runner class. Must be fully qualified.')
parser.add_argument( parser.add_argument(
'--shards', '--shards',
default=1, default=-1,
type=int, type=int,
help='Number of shards to run junit tests in parallel on. Only 1 shard ' help='Number of shards to run junit tests in parallel on. Only 1 shard '
'is supported when test-filter is specified. Values less than 1 will ' 'is supported when test-filter is specified. Values less than 1 will '
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment