OLD | NEW |
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 Loading... |
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) | |
146 }) | 145 }) |
147 if i not in missing_shards: | 146 if i not in missing_shards: |
148 swarming_path = str(i) | 147 swarming_path = str(i) |
149 swarming_path += '\\output.json' if is_win else '/output.json' | 148 swarming_path += '\\output.json' if is_win else '/output.json' |
150 if i not in empty_shards: | 149 if i not in empty_shards: |
151 files_dict[swarming_path] = json.dumps(per_shard_results[i]) | 150 files_dict[swarming_path] = json.dumps(per_shard_results[i]) |
152 else: | 151 else: |
153 # Simulate a complete harness failure. | 152 # Simulate a complete harness failure. |
154 files_dict[swarming_path] = '' | 153 files_dict[swarming_path] = '' |
155 jsonish_summary = {'shards': jsonish_shards} | 154 jsonish_summary = {'shards': jsonish_shards} |
156 files_dict['summary.json'] = json.dumps(jsonish_summary) | 155 files_dict['summary.json'] = json.dumps(jsonish_summary) |
157 return self.m.raw_io.output_dir(files_dict) | 156 return self.m.raw_io.output_dir(files_dict) |
158 else: | 157 else: |
159 return self.m.json.output(per_shard_results[0]) | 158 return self.m.json.output(per_shard_results[0]) |
OLD | NEW |