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

Side by Side Diff: scripts/slave/recipe_modules/test_utils/test_api.py

Issue 2362733002: [swarming/api] Add text in to indicate whether a shard is failing (Closed)
Patch Set: Update swarming summary.json generation 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
OLDNEW
1 import json 1 import json
2 2
3 from recipe_engine import recipe_test_api 3 from recipe_engine import recipe_test_api
4 4
5 from .util import GTestResults, TestResults 5 from .util import GTestResults, TestResults
6 6
7 class TestUtilsTestApi(recipe_test_api.RecipeTestApi): 7 class TestUtilsTestApi(recipe_test_api.RecipeTestApi):
8 @recipe_test_api.placeholder_step_data 8 @recipe_test_api.placeholder_step_data
9 def test_results(self, test_results, retcode=None): 9 def test_results(self, test_results, retcode=None):
10 return self.m.json.output(test_results.as_jsonish(), retcode) 10 return self.m.json.output(test_results.as_jsonish(), retcode)
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 jsonish_results['failures'] = tests_run 134 jsonish_results['failures'] = tests_run
135 jsonish_results['successes'] = [] 135 jsonish_results['successes'] = []
136 jsonish_results['times'] = {t : 0.1 for t in tests_run} 136 jsonish_results['times'] = {t : 0.1 for t in tests_run}
137 per_shard_results.append(jsonish_results) 137 per_shard_results.append(jsonish_results)
138 if swarming: 138 if swarming:
139 jsonish_shards = [] 139 jsonish_shards = []
140 files_dict = {} 140 files_dict = {}
141 for i in xrange(shards): 141 for i in xrange(shards):
142 jsonish_shards.append({ 142 jsonish_shards.append({
143 'failure': not passing, 143 'failure': not passing,
144 'internal_failure': swarming_internal_failure 144 'internal_failure': swarming_internal_failure,
145 'exit_code': (1 if (not passing or swarming_internal_failure) else 0)
145 }) 146 })
146 if i not in missing_shards: 147 if i not in missing_shards:
147 swarming_path = str(i) 148 swarming_path = str(i)
148 swarming_path += '\\output.json' if is_win else '/output.json' 149 swarming_path += '\\output.json' if is_win else '/output.json'
149 if i not in empty_shards: 150 if i not in empty_shards:
150 files_dict[swarming_path] = json.dumps(per_shard_results[i]) 151 files_dict[swarming_path] = json.dumps(per_shard_results[i])
151 else: 152 else:
152 # Simulate a complete harness failure. 153 # Simulate a complete harness failure.
153 files_dict[swarming_path] = '' 154 files_dict[swarming_path] = ''
154 jsonish_summary = {'shards': jsonish_shards} 155 jsonish_summary = {'shards': jsonish_shards}
155 files_dict['summary.json'] = json.dumps(jsonish_summary) 156 files_dict['summary.json'] = json.dumps(jsonish_summary)
156 return self.m.raw_io.output_dir(files_dict) 157 return self.m.raw_io.output_dir(files_dict)
157 else: 158 else:
158 return self.m.json.output(per_shard_results[0]) 159 return self.m.json.output(per_shard_results[0])
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698