Commit 75add604 authored by Yuke Liao's avatar Yuke Liao Committed by Commit Bot

[code coverage] Do not retry invalid shards in coverage build

This CL disables retrying invalid shards in coverage build.

Bug: 1119972
Change-Id: If0679948a745f5897835ebd823d3201fcfcb661e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2368235Reviewed-by: default avatarStephen Martinis <martiniss@chromium.org>
Commit-Queue: Yuke Liao <liaoyuke@chromium.org>
Cr-Commit-Position: refs/heads/master@{#800410}
parent 46ba6769
......@@ -119,10 +119,6 @@ def main():
'w') as f:
json.dump(invalid_profiles, f)
if not params.per_cl_coverage:
mark_invalid_shards(
profile_merger.get_shards_to_retry(invalid_profiles),
params.jsons_to_merge)
failed = False
# If given, always run the additional merge script, even if we only have one
......@@ -164,28 +160,6 @@ def main():
return 1 if (failed or bool(invalid_profiles)) else 0
def mark_invalid_shards(bad_shards, jsons_to_merge):
"""Removes results json files from bad shards.
This is needed so that the caller (e.g. recipe) knows to retry, or otherwise
treat the tests in that shard as not having valid results. Note that this only
removes the results from the local machine, as these are expected to remain in
the shard's isolated output.
Args:
bad_shards: list of task_ids of the shards that are bad or corrupted.
jsons_to_merge: The path to the jsons with the results of the tests.
"""
if not bad_shards:
return
for f in jsons_to_merge:
for task_id in bad_shards:
if task_id in f:
# Remove results json if it corresponds to a bad shard.
os.remove(f)
break
if __name__ == '__main__':
logging.basicConfig(
format='[%(asctime)s %(levelname)s] %(message)s', level=logging.INFO)
......
......@@ -237,26 +237,6 @@ class MergeProfilesTest(unittest.TestCase):
# The mock method should only apply when merging .profraw files.
self.assertFalse(mock_validate_and_convert_profraws.called)
@mock.patch('os.remove')
def test_mark_invalid_shards(self, mock_rm):
merge_results.mark_invalid_shards(['123abc'], [
'/tmp/123abc/dummy.json', '/tmp/123abc/dummy2.json',
'/tmp/1234abc/dummy.json'
])
self.assertEqual([
mock.call('/tmp/123abc/dummy.json'),
mock.call('/tmp/123abc/dummy2.json')
], mock_rm.call_args_list)
def test_get_shards_to_retry(self):
bad_profiles = [
'/b/s/w/ir/tmp/t/tmpSvBRii/44b643576cf39f10/profraw/default-1.profraw',
'/b/s/w/ir/tmp/t/tmpAbCDEf/44b1234567890123/profraw/default-1.profraw',
'/b/s/w/ir/tmp/t/tmpAbCDEf/44b1234567890123/profraw/default-2.profraw',
]
self.assertEqual(set(['44b643576cf39f10', '44b1234567890123']),
merger.get_shards_to_retry(bad_profiles))
@mock.patch('merge_lib._JAVA_PATH', 'java')
def test_merge_java_exec_files(self):
mock_input_dir_walk = [
......
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