Commit 4146efbf authored by Michael Achenbach's avatar Michael Achenbach Committed by Commit Bot

[foozzie] Refactoring - simplify suppressions

This makes output and test-case suppressions independent of the used
comparison configs and architecture. Such fine-grained suppressions
were only needed during the inception of differential fuzzing, but
by now, most remaining suppressions are implemented in d8 behind
a flag.

This prepares for running with more than two comparison configs in a
follow up.

No-Try: true
Bug: chromium:1100114
Change-Id: I072769adb3ef7c6e6c43459aa23ac906f461b307
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2270095
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Reviewed-by: 's avatarLiviu Rau <liviurau@chromium.org>
Reviewed-by: 's avatarTamer Tas <tmrts@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68579}
parent b33e2b6e
......@@ -370,13 +370,7 @@ def run_sanity_checks(options, suppress, first_cmd, second_cmd):
def main():
options = parse_args()
# Suppressions are architecture and configuration specific.
suppress = v8_suppressions.get_suppression(
options.first.arch, options.first.config,
options.second.arch, options.second.config,
options.skip_suppressions,
)
suppress = v8_suppressions.get_suppression(options.skip_suppressions)
# Static bailout based on test case content or metadata.
kwargs = {}
......@@ -409,8 +403,8 @@ def main():
# Only bail out due to suppressed output if there was a difference. If a
# suppression doesn't show up anymore in the statistics, we might want to
# remove it.
fail_bailout(first_config_output, suppress.ignore_by_output1)
fail_bailout(second_config_output, suppress.ignore_by_output2)
fail_bailout(first_config_output, suppress.ignore_by_output)
fail_bailout(second_config_output, suppress.ignore_by_output)
source_key = cluster_failures(source)
raise FailException(format_difference(
......
......@@ -120,8 +120,7 @@ class UnitTest(unittest.TestCase):
def testDiff(self):
def diff_fun(one, two, skip=False):
suppress = v8_suppressions.get_suppression(
'x64', 'ignition', 'x64', 'ignition_turbo', skip)
suppress = v8_suppressions.get_suppression(skip)
return suppress.diff_lines(one.splitlines(), two.splitlines())
one = ''
......
......@@ -40,31 +40,23 @@ MAX_LINE_LENGTH = 512
# For ignoring lines before carets and to ignore caret positions.
CARET_RE = re.compile(r'^\s*\^\s*$')
# Ignore by original source files. Map from bug->list of relative file paths in
# V8, e.g. '/v8/test/mjsunit/d8-performance-now.js' including /v8/. A test will
# be suppressed if one of the files below was used to mutate the test.
# Ignore by original source files. Map from bug->list of relative file paths,
# e.g. 'v8/test/mjsunit/d8-performance-now.js'. A test will be suppressed if
# one of the files below was used to mutate the test.
IGNORE_SOURCES = {
}
# Ignore by test case pattern. Map from config->bug->regexp. Config '' is used
# to match all configurations. Otherwise use either a compiler configuration,
# e.g. ignition or validate_asm or an architecture, e.g. x64 or ia32.
# Ignore by test case pattern. Map from bug->regexp.
# Bug is preferred to be a crbug.com/XYZ, but can be any short distinguishable
# label.
# Regular expressions are assumed to be compiled. We use regexp.search.
IGNORE_TEST_CASES = {
}
# Ignore by output pattern. Map from config->bug->regexp. See IGNORE_TEST_CASES
# on how to specify config keys.
# Bug is preferred to be a crbug.com/XYZ, but can be any short distinguishable
# label.
# Regular expressions are assumed to be compiled. We use regexp.search.
# Ignore by output pattern. Map from bug->regexp like above.
IGNORE_OUTPUT = {
'': {
'crbug.com/689877':
re.compile(r'^.*SyntaxError: .*Stack overflow$', re.M),
},
}
# Lines matching any of the following regular expressions will be ignored
......@@ -216,33 +208,12 @@ def diff_output(output1, output2, allowed, ignore1, ignore2):
return None, source
def get_suppression(arch1, config1, arch2, config2, skip=False):
return V8Suppression(arch1, config1, arch2, config2, skip)
class Suppression(object):
def diff(self, output1, output2):
return None
def get_suppression(skip=False):
return V8Suppression(skip)
def ignore_by_metadata(self, metadata):
return None
def ignore_by_content(self, testcase):
return None
def ignore_by_output1(self, output):
return None
def ignore_by_output2(self, output):
return None
class V8Suppression(Suppression):
def __init__(self, arch1, config1, arch2, config2, skip):
self.arch1 = arch1
self.config1 = config1
self.arch2 = arch2
self.config2 = config2
class V8Suppression(object):
def __init__(self, skip):
if skip:
self.allowed_line_diffs = []
self.ignore_output = {}
......@@ -277,8 +248,7 @@ class V8Suppression(Suppression):
# Search the whole test case if preamble can't be found. E.g. older
# already minimized test cases might have dropped the delimiter line.
content = testcase
for key in ['', self.arch1, self.arch2, self.config1, self.config2]:
for bug, exp in IGNORE_TEST_CASES.get(key, {}).items():
for bug, exp in IGNORE_TEST_CASES.items():
if exp.search(content):
return bug
return None
......@@ -290,20 +260,13 @@ class V8Suppression(Suppression):
return bug
return None
def ignore_by_output1(self, output):
return self.ignore_by_output(output, self.arch1, self.config1)
def ignore_by_output2(self, output):
return self.ignore_by_output(output, self.arch2, self.config2)
def ignore_by_output(self, output, arch, config):
def ignore_by_output(self, output):
def check(mapping):
for bug, exp in mapping.items():
if exp.search(output):
return bug
return None
for key in ['', arch, config]:
bug = check(self.ignore_output.get(key, {}))
bug = check(self.ignore_output)
if bug:
return bug
return None
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment