OLD | NEW |
1 # Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 waterfall import extractor_util | 5 from waterfall import extractor_util |
6 | 6 |
7 | 7 |
8 class Extractor(object): | 8 class Extractor(object): |
9 """An interface to extract failure signal from a failed step or test.""" | 9 """An interface to extract failure signal from a failed step or test.""" |
10 | 10 |
11 def ExtractFiles(self, message_line, failure_signal): | 11 def ExtractFiles(self, message_line, failure_signal): |
12 """Extract files from given message line into ``failure_signal``.""" | 12 """Extract files from given message line into ``failure_signal``.""" |
13 match = extractor_util.PYTHON_STACK_TRACE_PATTERN.match(message_line) | 13 match = extractor_util.PYTHON_STACK_TRACE_PATTERN.match(message_line) |
14 if match: | 14 if match: |
15 trace_line = match.groupdict() | 15 trace_line = match.groupdict() |
16 failure_signal.AddFile(trace_line['file'], trace_line['line']) | 16 failure_signal.AddFile( |
| 17 extractor_util.NormalizeFilePath(trace_line['file']), |
| 18 trace_line['line']) |
17 else: | 19 else: |
18 for match in extractor_util.FILE_PATH_LINE_PATTERN.finditer(message_line): | 20 for match in extractor_util.FILE_PATH_LINE_PATTERN.finditer(message_line): |
19 file_path, line_number = match.groups() | 21 file_path, line_number = match.groups() |
20 failure_signal.AddFile(extractor_util.NormalizeFilePath(file_path), | 22 failure_signal.AddFile(extractor_util.NormalizeFilePath(file_path), |
21 line_number) | 23 line_number) |
22 | 24 |
23 | 25 |
24 # pylint disable=W0613, R0201 | 26 # pylint disable=W0613, R0201 |
25 def Extract(self, failure_log, test_name, step_name, bot_name, master_name): | 27 def Extract(self, failure_log, test_name, step_name, bot_name, master_name): |
26 """Analyze ``failure_log``, extract and return a FailureSignal.""" | 28 """Analyze ``failure_log``, extract and return a FailureSignal.""" |
27 raise NotImplementedError() | 29 raise NotImplementedError() |
OLD | NEW |