| 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 chartjsonish_results['charts'] = {'entry%d' % idx: 'chart%d' % idx, | 141 chartjsonish_results['charts'] = {'entry%d' % idx: 'chart%d' % idx, |
| 142 'entry%d' % (idx + 1): 'chart%d' % (idx + 1)} | 142 'entry%d' % (idx + 1): 'chart%d' % (idx + 1)} |
| 143 per_shard_results.append(jsonish_results) | 143 per_shard_results.append(jsonish_results) |
| 144 per_shard_chartjson_results.append(chartjsonish_results) | 144 per_shard_chartjson_results.append(chartjsonish_results) |
| 145 if swarming: | 145 if swarming: |
| 146 jsonish_shards = [] | 146 jsonish_shards = [] |
| 147 files_dict = {} | 147 files_dict = {} |
| 148 for i in xrange(shards): | 148 for i in xrange(shards): |
| 149 jsonish_shards.append({ | 149 jsonish_shards.append({ |
| 150 'failure': not passing, | 150 'failure': not passing, |
| 151 'internal_failure': swarming_internal_failure | 151 'internal_failure': swarming_internal_failure, |
| 152 'exit_code': '1' if not passing or swarming_internal_failure else '0' |
| 152 }) | 153 }) |
| 153 swarming_path = str(i) | 154 swarming_path = str(i) |
| 154 swarming_path += '\\output.json' if is_win else '/output.json' | 155 swarming_path += '\\output.json' if is_win else '/output.json' |
| 155 | 156 |
| 156 chartjson_swarming_path = str(i) | 157 chartjson_swarming_path = str(i) |
| 157 chartjson_swarming_path += \ | 158 chartjson_swarming_path += \ |
| 158 '\\chartjson-output.json' \ | 159 '\\chartjson-output.json' \ |
| 159 if is_win else '/chartjson-output.json' | 160 if is_win else '/chartjson-output.json' |
| 160 | 161 |
| 161 # Determine what output we are writing and if it is empty or not | 162 # Determine what output we are writing and if it is empty or not |
| 162 output_missing = i in missing_shards and not output_chartjson | 163 output_missing = i in missing_shards and not output_chartjson |
| 163 chartjson_output_missing = i in missing_shards and output_chartjson | 164 chartjson_output_missing = i in missing_shards and output_chartjson |
| 164 output_empty = i in empty_shards and not output_chartjson | 165 output_empty = i in empty_shards and not output_chartjson |
| 165 chartjson_output_empty = i in empty_shards and output_chartjson | 166 chartjson_output_empty = i in empty_shards and output_chartjson |
| 166 | 167 |
| 167 if not output_missing: | 168 if not output_missing: |
| 168 files_dict[swarming_path] = \ | 169 files_dict[swarming_path] = \ |
| 169 '' if output_empty else json.dumps(per_shard_results[i]) | 170 '' if output_empty else json.dumps(per_shard_results[i]) |
| 170 if not chartjson_output_missing and output_chartjson: | 171 if not chartjson_output_missing and output_chartjson: |
| 171 files_dict[chartjson_swarming_path] = \ | 172 files_dict[chartjson_swarming_path] = \ |
| 172 '' if chartjson_output_empty \ | 173 '' if chartjson_output_empty \ |
| 173 else json.dumps(per_shard_chartjson_results[i]) | 174 else json.dumps(per_shard_chartjson_results[i]) |
| 174 | 175 |
| 175 jsonish_summary = {'shards': jsonish_shards} | 176 jsonish_summary = {'shards': jsonish_shards} |
| 176 files_dict['summary.json'] = json.dumps(jsonish_summary) | 177 files_dict['summary.json'] = json.dumps(jsonish_summary) |
| 177 return self.m.raw_io.output_dir(files_dict) | 178 return self.m.raw_io.output_dir(files_dict) |
| 178 else: | 179 else: |
| 179 return self.m.json.output(per_shard_results[0]) | 180 return self.m.json.output(per_shard_results[0]) |
| OLD | NEW |