Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 from common.git_repository import GitRepository | 5 from common.git_repository import GitRepository |
| 6 from common.http_client_appengine import HttpClientAppengine as HttpClient | 6 from common.http_client_appengine import HttpClientAppengine as HttpClient |
| 7 from model import wf_analysis_status | 7 from model import wf_analysis_status |
| 8 from model.wf_try_job import WfTryJob | 8 from model.wf_try_job import WfTryJob |
| 9 from pipeline_wrapper import BasePipeline | 9 from pipeline_wrapper import BasePipeline |
| 10 from waterfall.try_job_type import TryJobType | 10 from waterfall.try_job_type import TryJobType |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 173 culprits = None | 173 culprits = None |
| 174 if result and result.get('report'): | 174 if result and result.get('report'): |
| 175 if try_job_type == TryJobType.COMPILE: | 175 if try_job_type == TryJobType.COMPILE: |
| 176 # For compile failures, the try job will stop if one revision fails, so | 176 # For compile failures, the try job will stop if one revision fails, so |
| 177 # the culprit will be the last revision in the result. | 177 # the culprit will be the last revision in the result. |
| 178 failed_revision = self._GetFailedRevisionFromCompileResult( | 178 failed_revision = self._GetFailedRevisionFromCompileResult( |
| 179 result) | 179 result) |
| 180 failed_revisions = [failed_revision] if failed_revision else [] | 180 failed_revisions = [failed_revision] if failed_revision else [] |
| 181 culprits = self._GetCulpritInfo(failed_revisions) | 181 culprits = self._GetCulpritInfo(failed_revisions) |
| 182 if culprits: | 182 if culprits: |
| 183 result['culprit'] = culprits[failed_revision] | 183 result['culprit'] = { |
| 184 'compile': culprits[failed_revisions[0]] | |
|
stgao
2016/02/02 21:08:33
use failed_revision directly instead?
chanli
2016/02/02 22:18:13
Done.
| |
| 185 } | |
| 184 else: # try_job_type is 'test'. | 186 else: # try_job_type is 'test'. |
| 185 culprit_map, failed_revisions = self._FindCulpritForEachTestFailure( | 187 culprit_map, failed_revisions = self._FindCulpritForEachTestFailure( |
| 186 blame_list, result) | 188 blame_list, result) |
| 187 culprits = self._GetCulpritInfo(failed_revisions) | 189 culprits = self._GetCulpritInfo(failed_revisions) |
| 188 if culprits: | 190 if culprits: |
| 189 self._UpdateCulpritMapWithCulpritInfo(culprit_map, culprits) | 191 self._UpdateCulpritMapWithCulpritInfo(culprit_map, culprits) |
| 190 result['culprit'] = culprit_map | 192 result['culprit'] = culprit_map |
| 191 | 193 |
| 192 # Store try job results. | 194 # Store try job results. |
| 193 try_job_result = WfTryJob.Get(master_name, builder_name, build_number) | 195 try_job_result = WfTryJob.Get(master_name, builder_name, build_number) |
| 194 if culprits: | 196 if culprits: |
| 195 result_to_update = ( | 197 result_to_update = ( |
| 196 try_job_result.compile_results if | 198 try_job_result.compile_results if |
| 197 try_job_type == TryJobType.COMPILE else | 199 try_job_type == TryJobType.COMPILE else |
| 198 try_job_result.test_results) | 200 try_job_result.test_results) |
| 199 if (result_to_update and | 201 if (result_to_update and |
| 200 result_to_update[-1]['try_job_id'] == try_job_id): | 202 result_to_update[-1]['try_job_id'] == try_job_id): |
| 201 result_to_update[-1].update(result) | 203 result_to_update[-1].update(result) |
| 202 | 204 |
| 203 else: # pragma: no cover | 205 else: # pragma: no cover |
| 204 result_to_update.append(result) | 206 result_to_update.append(result) |
| 205 | 207 |
| 206 try_job_result.status = wf_analysis_status.ANALYZED | 208 try_job_result.status = wf_analysis_status.ANALYZED |
| 207 try_job_result.put() | 209 try_job_result.put() |
| 208 | 210 |
| 209 return result.get('culprit', None) if result else None | 211 return result.get('culprit', None) if result else None |
| OLD | NEW |