Commit 8024d8f4 authored by machenbach's avatar machenbach Committed by Commit bot

[foozzie] Add suppressions based on metadata.

Also suppress a testcase using f.arguments.

BUG=chromium:662424
TBR=jarin@chromium.org
NOTRY=true

Review-Url: https://codereview.chromium.org/2625983002
Cr-Commit-Position: refs/heads/master@{#42215}
parent 71f56508
......@@ -148,6 +148,16 @@ def parse_args():
return options
def metadata_bailout(metadata, ignore_fun):
"""Print failure state and return if ignore_fun matches metadata."""
bug = (ignore_fun(metadata) or '').strip()
if bug:
print FAILURE_HEADER_TEMPLATE % dict(
configs='', sources='', suppression=bug)
return True
return False
def test_pattern_bailout(testcase, ignore_fun):
"""Print failure state and return if ignore_fun matches testcase."""
with open(testcase) as f:
......@@ -191,13 +201,16 @@ def main():
options.second_arch, options.second_config,
)
if test_pattern_bailout(options.testcase, suppress.ignore):
return RETURN_FAIL
# Get metadata.
with open(options.meta_data_path) as f:
metadata = json.load(f)
if metadata_bailout(metadata, suppress.ignore_by_metadata):
return RETURN_FAIL
if test_pattern_bailout(options.testcase, suppress.ignore_by_content):
return RETURN_FAIL
common_flags = FLAGS + ['--random-seed', str(options.random_seed)]
first_config_flags = common_flags + CONFIGS[options.first_config]
second_config_flags = common_flags + CONFIGS[options.second_config]
......
......@@ -33,6 +33,14 @@ 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->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_SOURCES = {
# This contains a usage of f.arguments that often fires.
'crbug.com/662424': '/v8/test/mjsunit/regress/regress-2989.js',
}
# Ignore by test case pattern. Map from bug->regexp.
# Regular expressions are assumed to be compiled. We use regexp.match.
IGNORE_TEST_CASES = {
......@@ -213,7 +221,10 @@ class Suppression(object):
def diff(self, output1, output2):
return None
def ignore(self, testcase):
def ignore_by_metadata(self, metadata):
return False
def ignore_by_content(self, testcase):
return False
def ignore_by_output1(self, output):
......@@ -239,12 +250,18 @@ class V8Suppression(Suppression):
IGNORE_LINES,
)
def ignore(self, testcase):
def ignore_by_content(self, testcase):
for bug, exp in IGNORE_TEST_CASES.iteritems():
if exp.match(testcase):
return bug
return False
def ignore_by_metadata(self, metadata):
for bug, source in IGNORE_SOURCES.iteritems():
if source in metadata['sources']:
return bug
return False
def ignore_by_output1(self, output):
return self.ignore_by_output(output, self.arch1, self.config1)
......
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