Chromium Code Reviews| 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 |
| 21 from crash.chromecrash_parser import ChromeCrashParser | |
| 20 from crash.type_enums import CrashClient | 22 from crash.type_enums import CrashClient |
| 21 from model import analysis_status | 23 from model import analysis_status |
| 22 from model.crash.crash_config import CrashConfig | 24 from model.crash.crash_config import CrashConfig |
| 23 from model.crash.fracas_crash_analysis import FracasCrashAnalysis | 25 from model.crash.fracas_crash_analysis import FracasCrashAnalysis |
| 24 from model.crash.cracas_crash_analysis import CracasCrashAnalysis | 26 from model.crash.cracas_crash_analysis import CracasCrashAnalysis |
| 25 | 27 |
| 26 # TODO(katesonia): Move this to fracas config. | 28 # TODO(katesonia): Move this to fracas config. |
| 27 _FINDIT_FRACAS_FEEDBACK_URL_TEMPLATE = '%s/crash/fracas-result-feedback?key=%s' | 29 _FINDIT_FRACAS_FEEDBACK_URL_TEMPLATE = '%s/crash/fracas-result-feedback?key=%s' |
| 28 # TODO(katesonia): Move this to a common config in config page. | 30 # TODO(katesonia): Move this to a common config in config page. |
| 29 _SUPPORTED_CLIENTS = [CrashClient.FRACAS, CrashClient.CRACAS] | 31 _SUPPORTED_CLIENTS = [CrashClient.FRACAS, CrashClient.CRACAS] |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 92 elif client_id == CrashClient.CRACAS: # pragma: no cover. | 94 elif client_id == CrashClient.CRACAS: # pragma: no cover. |
| 93 return CracasCrashAnalysis.Create(crash_identifiers) | 95 return CracasCrashAnalysis.Create(crash_identifiers) |
| 94 elif client_id == CrashClient.CLUSTERFUZZ: # pragma: no cover. | 96 elif client_id == CrashClient.CLUSTERFUZZ: # pragma: no cover. |
| 95 # TODO(katesonia): define ClusterfuzzCrashAnalysis. | 97 # TODO(katesonia): define ClusterfuzzCrashAnalysis. |
| 96 return None | 98 return None |
| 97 | 99 |
| 98 return None | 100 return None |
| 99 | 101 |
| 100 | 102 |
| 101 def ResetAnalysis(analysis, chrome_version, signature, | 103 def ResetAnalysis(analysis, chrome_version, signature, |
| 102 client_id, platform, stack_trace, customized_data): | 104 client_id, platform, stack_trace, customized_data, |
| 105 regression_range): | |
| 103 """Sets necessary info in the analysis for findit to run analysis.""" | 106 """Sets necessary info in the analysis for findit to run analysis.""" |
| 104 analysis.Reset() | 107 analysis.Reset() |
| 105 | 108 |
| 106 # Set common properties. | 109 # Set common properties. |
| 107 analysis.crashed_version = chrome_version | 110 analysis.crashed_version = chrome_version |
| 108 analysis.stack_trace = stack_trace | 111 analysis.stack_trace = stack_trace |
| 109 analysis.signature = signature | 112 analysis.signature = signature |
| 110 analysis.platform = platform | 113 analysis.platform = platform |
| 111 analysis.client_id = client_id | 114 analysis.client_id = client_id |
| 115 analysis.regression_range = regression_range | |
| 112 | 116 |
| 113 if client_id == CrashClient.FRACAS or client_id == CrashClient.CRACAS: | 117 if client_id == CrashClient.FRACAS or client_id == CrashClient.CRACAS: |
| 114 # Set customized properties. | 118 # Set customized properties. |
| 115 analysis.historical_metadata = customized_data.get('historical_metadata') | 119 analysis.historical_metadata = customized_data.get('historical_metadata') |
| 116 analysis.channel = customized_data.get('channel') | 120 analysis.channel = customized_data.get('channel') |
| 117 elif client_id == CrashClient.CLUSTERFUZZ: # pragma: no cover. | 121 elif client_id == CrashClient.CLUSTERFUZZ: # pragma: no cover. |
| 118 # TODO(katesonia): Set up clusterfuzz customized data. | 122 # TODO(katesonia): Set up clusterfuzz customized data. |
| 119 pass | 123 pass |
| 120 | 124 |
| 121 # Set analysis progress properties. | 125 # Set analysis progress properties. |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 141 # TODO(katesonia): Post process clusterfuzz analysis result if needed. | 145 # TODO(katesonia): Post process clusterfuzz analysis result if needed. |
| 142 pass | 146 pass |
| 143 | 147 |
| 144 return { | 148 return { |
| 145 'crash_identifiers': crash_identifiers, | 149 'crash_identifiers': crash_identifiers, |
| 146 'client_id': analysis.client_id, | 150 'client_id': analysis.client_id, |
| 147 'result': analysis_result, | 151 'result': analysis_result, |
| 148 } | 152 } |
| 149 | 153 |
| 150 | 154 |
| 155 def GetRegressionRange(client_id, customized_data): | |
| 156 if client_id == CrashClient.FRACAS or client_id == CrashClient.CRACAS: | |
| 157 return detect_regression_range.DetectRegressionRange( | |
| 158 customized_data.get('historical_metadata')) | |
| 159 elif client_id == CrashClient.CLUSTERFUZZ: # pragma: no cover. | |
| 160 # TODO(katesonia): Get regression range from customized_data from | |
| 161 # clusterfuzz. | |
| 162 return None | |
| 163 | |
| 164 return None | |
| 165 | |
| 166 | |
| 167 def GetStacktraceParser(client_id): | |
|
stgao
2016/10/07 20:29:35
This seems unused for now.
Sharu Jiang
2016/10/07 22:05:03
Oops, should have deleted this.
| |
| 168 if (client_id == CrashClient.FRACAS or | |
| 169 client_id == CrashClient.CRACAS): | |
| 170 return ChromeCrashParser() | |
| 171 elif client_id == CrashClient.CLUSTERFUZZ: # pragma: no cover. | |
| 172 # TODO(katesonia): Implement findit_for_clusterfuzz. | |
| 173 return None | |
| 174 | |
| 175 return None | |
| 176 | |
| 177 | |
| 151 def FindCulprit(analysis): | 178 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 | 179 if (analysis.client_id == CrashClient.FRACAS or |
| 157 analysis.client_id == CrashClient.CRACAS): | 180 analysis.client_id == CrashClient.CRACAS): |
| 158 result, tags = findit_for_chromecrash.FinditForChromeCrash().FindCulprit( | 181 return findit_for_chromecrash.FinditForChromeCrash().FindCulprit( |
| 159 analysis.signature, analysis.platform, analysis.stack_trace, | 182 analysis.signature, analysis.platform, analysis.stack_trace, |
| 160 analysis.crashed_version, analysis.historical_metadata) | 183 analysis.crashed_version, analysis.regression_range) |
| 161 elif analysis.client_id == CrashClient.CLUSTERFUZZ: # pragma: no cover. | 184 elif analysis.client_id == CrashClient.CLUSTERFUZZ: # pragma: no cover. |
| 162 # TODO(katesonia): Implement findit_for_clusterfuzz. | 185 # TODO(katesonia): Implement findit_for_clusterfuzz. |
| 163 pass | 186 return {}, {} |
| 164 | 187 |
| 165 return result, tags | 188 return {'found': False}, {'found_suspects': False, |
| 189 'has_regression_range': False} | |
| OLD | NEW |