Chromium Code Reviews| Index: tools/findit/findit_for_clusterfuzz.py |
| diff --git a/tools/findit/findit_for_clusterfuzz.py b/tools/findit/findit_for_clusterfuzz.py |
| index 086ba9943073528ac3020f5534382cc16d32a984..fadf289f72813e91c20222268beb3c40dc515195 100644 |
| --- a/tools/findit/findit_for_clusterfuzz.py |
| +++ b/tools/findit/findit_for_clusterfuzz.py |
| @@ -1,10 +1,11 @@ |
| -# Copyright 2014 The Chromium Authors. All rights reserved. |
| +# Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| import logging |
| import chromium_deps |
| +from common import utils |
| import crash_utils |
| import findit_for_crash as findit |
| import stacktrace |
| @@ -33,7 +34,7 @@ def SplitStacktrace(stacktrace_string): |
| line = line.strip() |
| # If the line starts with +, it signifies the start of new stacktrace. |
| - if line.startswith('+'): |
| + if line.startswith('+-') and line.endswith('-+'): |
| if 'Release Build Stacktrace' in line: |
| in_release_or_debug_stacktrace = True |
| current_stacktrace_lines = [] |
| @@ -63,9 +64,15 @@ def FindCulpritCLs(stacktrace_string, |
| component_regression=None, |
| chrome_crash_revision=None, |
| component_crash_revision=None, |
| - crashing_component=None): |
| + crashing_component_path=None, |
| + crashing_component_name=None, |
| + crashing_component_repo_url=None): |
| """Returns the result, a list of result.Result objects and message. |
| + If either or both of component_regression and component_crash_revision is not |
| + None, is is assumed that crashing_component_path and |
| + crashing_component_repo_url are not None. |
| + |
| Args: |
| stacktrace_string: A string representing stacktrace. |
| build_type: The type of the job. |
| @@ -75,27 +82,26 @@ def FindCulpritCLs(stacktrace_string, |
| chrome_crash_revision: A crash revision of chrome, in string. |
| component_crash_revision: A crash revision of the component, |
| if component build. |
| - crashing_component: Yet to be decided. |
| + crashing_component_path: A relative path of the crashing component, as in |
| + DEPS file. For example, it would be 'src/v8' for |
| + v8 and 'src/third_party/WebKit' for blink. |
| + crashing_component_name: A name of the crashing component, such as v8. |
| + crashing_component_repo_url: The URL of the crashing component's repo, as |
| + shown in DEPS file. For example, |
| + 'https://chromium.googlesource.com/skia.git' |
| + for skia. |
| Returns: |
| A list of result objects, along with the short description on where the |
| result is from. |
| """ |
| build_type = build_type.lower() |
| - if 'syzyasan' in build_type: |
| - return ('This build type is currently not supported.', []) |
| - |
| logging.basicConfig(filename='errors.log', level=logging.WARNING, |
| filemode='w') |
| component_to_crash_revision_dict = {} |
| component_to_regression_dict = {} |
| - # TODO(jeun): Come up with a good way to connect crashing component name to |
| - # its path. |
| - if component_regression or component_crash_revision: |
| - return ('Component builds are not supported yet.', []) |
| - |
| # If chrome regression is available, parse DEPS file. |
| chrome_regression = crash_utils.SplitRange(chrome_regression) |
| if chrome_regression: |
| @@ -113,6 +119,68 @@ def FindCulpritCLs(stacktrace_string, |
| component_to_crash_revision_dict = chromium_deps.GetChromiumComponents( |
| chrome_crash_revision) |
| + # Check if component regression information is available. |
| + component_regression = crash_utils.SplitRange(component_regression) |
| + if component_regression: |
| + component_regression_start = component_regression[0] |
| + component_regression_end = component_regression[1] |
| + |
| + # If this component already has an entry in parsed DEPS file, overwrite |
| + # regression range and url. |
| + if crashing_component_path in component_to_regression_dict: |
| + component_regression_info = \ |
| + component_to_regression_dict[crashing_component_path] |
| + component_regression_info['old_revision'] = component_regression_start |
| + component_regression_info['new_revision'] = component_regression_end |
| + component_regression_info['repository'] = crashing_component_repo_url |
| + |
| + # if this component does not have an entry, add the entry to the parsed |
| + # DEPS file. |
| + else: |
| + if utils.IsGitHash(component_regression_start): |
|
Martin Barbella
2014/08/22 02:24:14
This pattern seems to come up a lot. Add a helper
jeun
2014/08/22 22:58:43
Done.
|
| + repository_type = 'git' |
| + else: |
| + repository_type = 'svn' |
| + |
| + component_regression_info = { |
| + 'path': crashing_component_path, |
| + 'rolled': True, |
| + 'name': crashing_component_name, |
| + 'old_revision': component_regression_start, |
| + 'new_revision': component_regression_end, |
| + 'repository': crashing_component_repo_url, |
| + 'repository_type': repository_type |
| + } |
| + component_to_regression_dict[crashing_component_path] = \ |
| + component_regression_info |
| + |
| + # If component crash revision is available, add it to the parsed crash |
| + # revisions. |
| + if component_crash_revision: |
| + |
| + # If this component has already a crash revision info, overwrite it. |
| + if crashing_component_path in component_to_crash_revision_dict: |
| + component_crash_revision_info = \ |
| + component_to_crash_revision_dict[crashing_component_path] |
| + component_crash_revision_info['revision'] = component_crash_revision |
| + component_crash_revision_info['repository'] = crashing_component_repo_url |
| + |
| + # If not, add it to the parsed DEPS. |
| + else: |
| + if utils.IsGitHash(component_crash_revision): |
| + repository_type = 'git' |
| + else: |
| + repository_type = 'svn' |
| + component_crash_revision_info = { |
| + 'path': crashing_component_path, |
| + 'name': crashing_component_name, |
| + 'repository': crashing_component_repo_url, |
| + 'repository_type': repository_type, |
| + 'revision': component_crash_revision |
| + } |
| + component_to_crash_revision_dict[crashing_component_path] = \ |
| + component_crash_revision_info |
| + |
| # Parsed DEPS is used to normalize the stacktrace. Since parsed regression |
| # and parsed crash state essentially contain same information, use either. |
| if component_to_regression_dict: |