| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 """This module is interfacas between clients-specific code and core. | 5 """This module is interfacas between clients-specific code and core. |
| 6 | 6 |
| 7 Note, fracas and cracas are almost identical and fracas is an intermidiate | 7 Note, fracas and cracas are almost identical and fracas is an intermidiate |
| 8 state while transfering to cracas, so they can be handled in the same code path | 8 state while transfering to cracas, so they can be handled in the same code path |
| 9 and can be referred to as chromecrash.""" | 9 and can be referred to as chromecrash.""" |
| 10 | 10 |
| 11 import copy | 11 import copy |
| 12 import json | 12 import json |
| 13 import logging | 13 import logging |
| 14 | 14 |
| 15 from google.appengine.ext import ndb | 15 from google.appengine.ext import ndb |
| 16 | 16 |
| 17 from common import appengine_util | 17 from common import appengine_util |
| 18 from common import time_util | 18 from common import time_util |
| 19 from crash import detect_regression_range |
| 19 from crash import findit_for_chromecrash | 20 from crash import findit_for_chromecrash |
| 20 from crash.type_enums import CrashClient | 21 from crash.type_enums import CrashClient |
| 21 from model import analysis_status | 22 from model import analysis_status |
| 22 from model.crash.crash_config import CrashConfig | 23 from model.crash.crash_config import CrashConfig |
| 23 from model.crash.fracas_crash_analysis import FracasCrashAnalysis | 24 from model.crash.fracas_crash_analysis import FracasCrashAnalysis |
| 24 from model.crash.cracas_crash_analysis import CracasCrashAnalysis | 25 from model.crash.cracas_crash_analysis import CracasCrashAnalysis |
| 25 | 26 |
| 26 # TODO(katesonia): Move this to fracas config. | 27 # TODO(katesonia): Move this to fracas config. |
| 27 _FINDIT_FRACAS_FEEDBACK_URL_TEMPLATE = '%s/crash/fracas-result-feedback?key=%s' | 28 _FINDIT_FRACAS_FEEDBACK_URL_TEMPLATE = '%s/crash/fracas-result-feedback?key=%s' |
| 28 # TODO(katesonia): Move this to a common config in config page. | 29 # TODO(katesonia): Move this to a common config in config page. |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 elif client_id == CrashClient.CRACAS: # pragma: no cover. | 93 elif client_id == CrashClient.CRACAS: # pragma: no cover. |
| 93 return CracasCrashAnalysis.Create(crash_identifiers) | 94 return CracasCrashAnalysis.Create(crash_identifiers) |
| 94 elif client_id == CrashClient.CLUSTERFUZZ: # pragma: no cover. | 95 elif client_id == CrashClient.CLUSTERFUZZ: # pragma: no cover. |
| 95 # TODO(katesonia): define ClusterfuzzCrashAnalysis. | 96 # TODO(katesonia): define ClusterfuzzCrashAnalysis. |
| 96 return None | 97 return None |
| 97 | 98 |
| 98 return None | 99 return None |
| 99 | 100 |
| 100 | 101 |
| 101 def ResetAnalysis(analysis, chrome_version, signature, | 102 def ResetAnalysis(analysis, chrome_version, signature, |
| 102 client_id, platform, stack_trace, customized_data): | 103 client_id, platform, stack_trace, customized_data, |
| 104 regression_range): |
| 103 """Sets necessary info in the analysis for findit to run analysis.""" | 105 """Sets necessary info in the analysis for findit to run analysis.""" |
| 104 analysis.Reset() | 106 analysis.Reset() |
| 105 | 107 |
| 106 # Set common properties. | 108 # Set common properties. |
| 107 analysis.crashed_version = chrome_version | 109 analysis.crashed_version = chrome_version |
| 108 analysis.stack_trace = stack_trace | 110 analysis.stack_trace = stack_trace |
| 109 analysis.signature = signature | 111 analysis.signature = signature |
| 110 analysis.platform = platform | 112 analysis.platform = platform |
| 111 analysis.client_id = client_id | 113 analysis.client_id = client_id |
| 114 analysis.regression_range = regression_range |
| 112 | 115 |
| 113 if client_id == CrashClient.FRACAS or client_id == CrashClient.CRACAS: | 116 if client_id == CrashClient.FRACAS or client_id == CrashClient.CRACAS: |
| 114 # Set customized properties. | 117 # Set customized properties. |
| 115 analysis.historical_metadata = customized_data.get('historical_metadata') | 118 analysis.historical_metadata = customized_data.get('historical_metadata') |
| 116 analysis.channel = customized_data.get('channel') | 119 analysis.channel = customized_data.get('channel') |
| 117 elif client_id == CrashClient.CLUSTERFUZZ: # pragma: no cover. | 120 elif client_id == CrashClient.CLUSTERFUZZ: # pragma: no cover. |
| 118 # TODO(katesonia): Set up clusterfuzz customized data. | 121 # TODO(katesonia): Set up clusterfuzz customized data. |
| 119 pass | 122 pass |
| 120 | 123 |
| 121 # Set analysis progress properties. | 124 # Set analysis progress properties. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 141 # TODO(katesonia): Post process clusterfuzz analysis result if needed. | 144 # TODO(katesonia): Post process clusterfuzz analysis result if needed. |
| 142 pass | 145 pass |
| 143 | 146 |
| 144 return { | 147 return { |
| 145 'crash_identifiers': crash_identifiers, | 148 'crash_identifiers': crash_identifiers, |
| 146 'client_id': analysis.client_id, | 149 'client_id': analysis.client_id, |
| 147 'result': analysis_result, | 150 'result': analysis_result, |
| 148 } | 151 } |
| 149 | 152 |
| 150 | 153 |
| 154 def GetRegressionRange(client_id, customized_data): |
| 155 if client_id == CrashClient.FRACAS or client_id == CrashClient.CRACAS: |
| 156 return detect_regression_range.DetectRegressionRange( |
| 157 customized_data.get('historical_metadata')) |
| 158 elif client_id == CrashClient.CLUSTERFUZZ: # pragma: no cover. |
| 159 # TODO(katesonia): Get regression range from customized_data from |
| 160 # clusterfuzz. |
| 161 return None |
| 162 |
| 163 return None |
| 164 |
| 165 |
| 151 def FindCulprit(analysis): | 166 def FindCulprit(analysis): |
| 152 result = {'found': False} | |
| 153 tags = {'found_suspects': False, | |
| 154 'has_regression_range': False} | |
| 155 | |
| 156 if (analysis.client_id == CrashClient.FRACAS or | 167 if (analysis.client_id == CrashClient.FRACAS or |
| 157 analysis.client_id == CrashClient.CRACAS): | 168 analysis.client_id == CrashClient.CRACAS): |
| 158 result, tags = findit_for_chromecrash.FinditForChromeCrash().FindCulprit( | 169 return findit_for_chromecrash.FinditForChromeCrash().FindCulprit( |
| 159 analysis.signature, analysis.platform, analysis.stack_trace, | 170 analysis.signature, analysis.platform, analysis.stack_trace, |
| 160 analysis.crashed_version, analysis.historical_metadata) | 171 analysis.crashed_version, analysis.regression_range) |
| 161 elif analysis.client_id == CrashClient.CLUSTERFUZZ: # pragma: no cover. | 172 elif analysis.client_id == CrashClient.CLUSTERFUZZ: # pragma: no cover. |
| 162 # TODO(katesonia): Implement findit_for_clusterfuzz. | 173 # TODO(katesonia): Implement findit_for_clusterfuzz. |
| 163 pass | 174 return {}, {} |
| 164 | 175 |
| 165 return result, tags | 176 return {'found': False}, {'found_suspects': False, |
| 177 'has_regression_range': False} |
| OLD | NEW |