| 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 from collections import OrderedDict |
| 6 |
| 5 | 7 |
| 6 class CallStackFormatType(object): | 8 class CallStackFormatType(object): |
| 7 JAVA = 1 | 9 JAVA = 1 |
| 8 SYZYASAN = 2 | 10 SYZYASAN = 2 |
| 9 DEFAULT = 3 | 11 DEFAULT = 3 |
| 10 | 12 |
| 11 | 13 |
| 12 class CrashClient(object): | 14 class CrashClient(object): |
| 13 FRACAS = 'fracas' | 15 FRACAS = 'fracas' |
| 14 CRACAS = 'cracas' | 16 CRACAS = 'cracas' |
| 15 CLUSTERFUZZ = 'clusterfuzz' | 17 CLUSTERFUZZ = 'clusterfuzz' |
| 16 | 18 |
| 17 | 19 |
| 18 class LanguageType(object): | 20 class LanguageType(object): |
| 19 CPP = 1 | 21 CPP = 1 |
| 20 JAVA = 2 | 22 JAVA = 2 |
| 23 |
| 24 |
| 25 class SanitizerType(object): |
| 26 ADDRESS_SANITIZER = 1, |
| 27 THREAD_SANITIZER = 2, |
| 28 MEMORY_SANITIZER = 3, |
| 29 SYZYASAN = 4, |
| 30 UBSAN = 5 |
| 31 UNSUPPORTED = 6 |
| 32 |
| 33 stacktrace_marker_to_sanitizer = { |
| 34 'AddressSanitizer': ADDRESS_SANITIZER, |
| 35 'ThreadSanitizer': THREAD_SANITIZER, |
| 36 'MemorySanitizer': MEMORY_SANITIZER, |
| 37 'syzyasan': SYZYASAN, |
| 38 ': runtime error:': UBSAN |
| 39 } |
| 40 |
| 41 # Some signature may contain others, for example 'syzyasan' contains 'asan', |
| 42 # in order to match signature in build type correctly, use ordered dict with |
| 43 # decreasing length of signature. |
| 44 job_type_marker_to_sanitizer = OrderedDict( |
| 45 [('syzyasan', SYZYASAN), |
| 46 ('ubsan', UBSAN), |
| 47 ('asan', ADDRESS_SANITIZER), |
| 48 ('msan', MEMORY_SANITIZER), |
| 49 ('tsan', THREAD_SANITIZER)]) |
| 50 |
| 51 @staticmethod |
| 52 def GetSanitizerType(job_type, stacktrace_string): |
| 53 for marker, sanitizer_type in ( |
| 54 SanitizerType.job_type_marker_to_sanitizer.iteritems()): |
| 55 if marker.lower() in job_type.lower(): |
| 56 return sanitizer_type |
| 57 |
| 58 for marker, sanitizer_type in ( |
| 59 SanitizerType.stacktrace_marker_to_sanitizer.iteritems()): |
| 60 if marker.lower() in stacktrace_string.lower(): |
| 61 return sanitizer_type |
| 62 |
| 63 return SanitizerType.UNSUPPORTED |
| OLD | NEW |