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

Side by Side Diff: scripts/slave/recipe_modules/swarming/resources/collect_gtest_task.py

Issue 2372853002: Revert of Size limit gtest collect (Closed)
Patch Set: Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import json 6 import json
7 import optparse 7 import optparse
8 import os 8 import os
9 import shutil 9 import shutil
10 import subprocess 10 import subprocess
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 'some shards did not complete: %s' % as_str, 87 'some shards did not complete: %s' % as_str,
88 MISSING_SHARDS_MSG % as_str) 88 MISSING_SHARDS_MSG % as_str)
89 # Not all tests run, combined JSON summary can not be trusted. 89 # Not all tests run, combined JSON summary can not be trusted.
90 merged['global_tags'].add('UNRELIABLE_RESULTS') 90 merged['global_tags'].add('UNRELIABLE_RESULTS')
91 91
92 # Convert to jsonish dict. 92 # Convert to jsonish dict.
93 for key in ('all_tests', 'disabled_tests', 'global_tags'): 93 for key in ('all_tests', 'disabled_tests', 'global_tags'):
94 merged[key] = sorted(merged[key]) 94 merged[key] = sorted(merged[key])
95 return merged 95 return merged
96 96
97 OUTPUT_JSON_SIZE_LIMIT = 2e7
98
99 97
100 def load_shard_json(output_dir, index): 98 def load_shard_json(output_dir, index):
101 """Reads JSON output of a single shard.""" 99 """Reads JSON output of a single shard."""
102 # 'output.json' is set in swarming/api.py, gtest_task method. 100 # 'output.json' is set in swarming/api.py, gtest_task method.
103 path = os.path.join(output_dir, str(index), 'output.json') 101 path = os.path.join(output_dir, str(index), 'output.json')
104 try: 102 try:
105 filesize = os.stat(path).st_size
106 if filesize > OUTPUT_JSON_SIZE_LIMIT:
107 raise ValueError()
108
109 with open(path) as f: 103 with open(path) as f:
110 return json.load(f) 104 return json.load(f)
111 except (IOError, ValueError): 105 except (IOError, ValueError):
112 print >> sys.stderr, 'Missing or invalid gtest JSON file: %s' % path 106 print >> sys.stderr, 'Missing or invalid gtest JSON file: %s' % path
113 return None 107 return None
114 108
115 109
116 def merge_list_of_dicts(left, right): 110 def merge_list_of_dicts(left, right):
117 """Merges dicts left[0] with right[0], left[1] with right[1], etc.""" 111 """Merges dicts left[0] with right[0], left[1] with right[1], etc."""
118 output = [] 112 output = []
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 'failed to process gtest output JSON', traceback.format_exc()) 190 'failed to process gtest output JSON', traceback.format_exc())
197 191
198 finally: 192 finally:
199 shutil.rmtree(task_output_dir, ignore_errors=True) 193 shutil.rmtree(task_output_dir, ignore_errors=True)
200 194
201 return exit_code 195 return exit_code
202 196
203 197
204 if __name__ == '__main__': 198 if __name__ == '__main__':
205 sys.exit(main(sys.argv[1:])) 199 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698