| OLD | NEW |
| 1 # Copyright 2016 the V8 project authors. All rights reserved. | 1 # Copyright 2016 the V8 project 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 """ | 5 """ |
| 6 Suppressions for V8 correctness fuzzer failures. | 6 Suppressions for V8 correctness fuzzer failures. |
| 7 | 7 |
| 8 We support three types of suppressions: | 8 We support three types of suppressions: |
| 9 1. Ignore test case by pattern. | 9 1. Ignore test case by pattern. |
| 10 Map a regular expression to a bug entry. A new failure will be reported | 10 Map a regular expression to a bug entry. A new failure will be reported |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 import itertools | 27 import itertools |
| 28 import re | 28 import re |
| 29 | 29 |
| 30 # Max line length for regular experessions checking for lines to ignore. | 30 # Max line length for regular experessions checking for lines to ignore. |
| 31 MAX_LINE_LENGTH = 512 | 31 MAX_LINE_LENGTH = 512 |
| 32 | 32 |
| 33 # For ignoring lines before carets and to ignore caret positions. | 33 # For ignoring lines before carets and to ignore caret positions. |
| 34 CARET_RE = re.compile(r'^\s*\^\s*$') | 34 CARET_RE = re.compile(r'^\s*\^\s*$') |
| 35 | 35 |
| 36 # Ignore by original source files. Map from bug->relative file paths in V8, |
| 37 # e.g. '/v8/test/mjsunit/d8-performance-now.js' including /v8/. A test will |
| 38 # be suppressed if one of the files below was used to mutate the test. |
| 39 IGNORE_SOURCES = { |
| 40 # This contains a usage of f.arguments that often fires. |
| 41 'crbug.com/662424': '/v8/test/mjsunit/regress/regress-2989.js', |
| 42 } |
| 43 |
| 36 # Ignore by test case pattern. Map from bug->regexp. | 44 # Ignore by test case pattern. Map from bug->regexp. |
| 37 # Regular expressions are assumed to be compiled. We use regexp.match. | 45 # Regular expressions are assumed to be compiled. We use regexp.match. |
| 38 IGNORE_TEST_CASES = { | 46 IGNORE_TEST_CASES = { |
| 39 'crbug.com/662907': | 47 'crbug.com/662907': |
| 40 re.compile(r'.*new Array.*\[\d+\] =.*' | 48 re.compile(r'.*new Array.*\[\d+\] =.*' |
| 41 r'((Array)|(Object)).prototype.__defineSetter__.*', re.S), | 49 r'((Array)|(Object)).prototype.__defineSetter__.*', re.S), |
| 42 | 50 |
| 43 'crbug.com/663340': | 51 'crbug.com/663340': |
| 44 re.compile(r'.*\.shift\(\).*', re.S), | 52 re.compile(r'.*\.shift\(\).*', re.S), |
| 45 | 53 |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 | 214 |
| 207 | 215 |
| 208 def get_suppression(arch1, config1, arch2, config2): | 216 def get_suppression(arch1, config1, arch2, config2): |
| 209 return V8Suppression(arch1, config1, arch2, config2) | 217 return V8Suppression(arch1, config1, arch2, config2) |
| 210 | 218 |
| 211 | 219 |
| 212 class Suppression(object): | 220 class Suppression(object): |
| 213 def diff(self, output1, output2): | 221 def diff(self, output1, output2): |
| 214 return None | 222 return None |
| 215 | 223 |
| 216 def ignore(self, testcase): | 224 def ignore_by_metadata(self, metadata): |
| 225 return False |
| 226 |
| 227 def ignore_by_content(self, testcase): |
| 217 return False | 228 return False |
| 218 | 229 |
| 219 def ignore_by_output1(self, output): | 230 def ignore_by_output1(self, output): |
| 220 return False | 231 return False |
| 221 | 232 |
| 222 def ignore_by_output2(self, output): | 233 def ignore_by_output2(self, output): |
| 223 return False | 234 return False |
| 224 | 235 |
| 225 | 236 |
| 226 class V8Suppression(Suppression): | 237 class V8Suppression(Suppression): |
| 227 def __init__(self, arch1, config1, arch2, config2): | 238 def __init__(self, arch1, config1, arch2, config2): |
| 228 self.arch1 = arch1 | 239 self.arch1 = arch1 |
| 229 self.config1 = config1 | 240 self.config1 = config1 |
| 230 self.arch2 = arch2 | 241 self.arch2 = arch2 |
| 231 self.config2 = config2 | 242 self.config2 = config2 |
| 232 | 243 |
| 233 def diff(self, output1, output2): | 244 def diff(self, output1, output2): |
| 234 return diff_output( | 245 return diff_output( |
| 235 output1.splitlines(), | 246 output1.splitlines(), |
| 236 output2.splitlines(), | 247 output2.splitlines(), |
| 237 ALLOWED_LINE_DIFFS, | 248 ALLOWED_LINE_DIFFS, |
| 238 IGNORE_LINES, | 249 IGNORE_LINES, |
| 239 IGNORE_LINES, | 250 IGNORE_LINES, |
| 240 ) | 251 ) |
| 241 | 252 |
| 242 def ignore(self, testcase): | 253 def ignore_by_content(self, testcase): |
| 243 for bug, exp in IGNORE_TEST_CASES.iteritems(): | 254 for bug, exp in IGNORE_TEST_CASES.iteritems(): |
| 244 if exp.match(testcase): | 255 if exp.match(testcase): |
| 245 return bug | 256 return bug |
| 246 return False | 257 return False |
| 247 | 258 |
| 259 def ignore_by_metadata(self, metadata): |
| 260 for bug, source in IGNORE_SOURCES.iteritems(): |
| 261 if source in metadata['sources']: |
| 262 return bug |
| 263 return False |
| 264 |
| 248 def ignore_by_output1(self, output): | 265 def ignore_by_output1(self, output): |
| 249 return self.ignore_by_output(output, self.arch1, self.config1) | 266 return self.ignore_by_output(output, self.arch1, self.config1) |
| 250 | 267 |
| 251 def ignore_by_output2(self, output): | 268 def ignore_by_output2(self, output): |
| 252 return self.ignore_by_output(output, self.arch2, self.config2) | 269 return self.ignore_by_output(output, self.arch2, self.config2) |
| 253 | 270 |
| 254 def ignore_by_output(self, output, arch, config): | 271 def ignore_by_output(self, output, arch, config): |
| 255 def check(mapping): | 272 def check(mapping): |
| 256 for bug, exp in mapping.iteritems(): | 273 for bug, exp in mapping.iteritems(): |
| 257 if exp.search(output): | 274 if exp.search(output): |
| 258 return bug | 275 return bug |
| 259 return None | 276 return None |
| 260 bug = check(IGNORE_OUTPUT.get('', {})) | 277 bug = check(IGNORE_OUTPUT.get('', {})) |
| 261 if bug: | 278 if bug: |
| 262 return bug | 279 return bug |
| 263 bug = check(IGNORE_OUTPUT.get(arch, {})) | 280 bug = check(IGNORE_OUTPUT.get(arch, {})) |
| 264 if bug: | 281 if bug: |
| 265 return bug | 282 return bug |
| 266 bug = check(IGNORE_OUTPUT.get(config, {})) | 283 bug = check(IGNORE_OUTPUT.get(config, {})) |
| 267 if bug: | 284 if bug: |
| 268 return bug | 285 return bug |
| 269 bug = check(IGNORE_OUTPUT.get('%s,%s' % (arch, config), {})) | 286 bug = check(IGNORE_OUTPUT.get('%s,%s' % (arch, config), {})) |
| 270 if bug: | 287 if bug: |
| 271 return bug | 288 return bug |
| 272 return None | 289 return None |
| OLD | NEW |