Commit 687fa1f2 authored by Xianzhu Wang's avatar Xianzhu Wang Committed by Commit Bot

Report redundant test expectations except for wpt tests

This avoids red webkit_lint step on bots and sheriff efforts to fix
that. Also gives developers warning for manual redundant test
expectations.

Change-Id: I29a46031686812372a38e394e89f67d2da441c47
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2490825
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Reviewed-by: default avatarRobert Ma <robertma@chromium.org>
Cr-Commit-Position: refs/heads/master@{#820119}
parent b8ccc142
...@@ -223,6 +223,10 @@ def _check_redundant_virtual_expectations(host, port, path, expectations): ...@@ -223,6 +223,10 @@ def _check_redundant_virtual_expectations(host, port, path, expectations):
for exp in expectations: for exp in expectations:
if not exp.test: if not exp.test:
continue continue
# TODO(crbug.com/1080691): For now, ignore redundant entries created by
# WPT import.
if port.is_wpt_test(exp.test):
continue
base_test = port.lookup_virtual_test_base(exp.test) base_test = port.lookup_virtual_test_base(exp.test)
if base_test: if base_test:
...@@ -313,10 +317,8 @@ def _check_expectations(host, port, path, test_expectations, options, wpt_tests) ...@@ -313,10 +317,8 @@ def _check_expectations(host, port, path, test_expectations, options, wpt_tests)
host, port, path, expectations)) host, port, path, expectations))
# TODO(crbug.com/1080691): Change this to failures once # TODO(crbug.com/1080691): Change this to failures once
# wpt_expectations_updater is fixed. # wpt_expectations_updater is fixed.
if not getattr(options, 'no_check_redundant_virtual_expectations', False):
warnings.extend( warnings.extend(
_check_redundant_virtual_expectations(host, port, path, _check_redundant_virtual_expectations(host, port, path, expectations))
expectations))
return failures, warnings return failures, warnings
...@@ -459,10 +461,6 @@ def main(argv, stderr, host=None): ...@@ -459,10 +461,6 @@ def main(argv, stderr, host=None):
action='append', action='append',
default=[], default=[],
help='paths to additional expectation files to lint.') help='paths to additional expectation files to lint.')
parser.add_option('--no-check-redundant-virtual-expectations',
action='store_true',
default=False,
help='skip checking redundant virtual expectations.')
options, _ = parser.parse_args(argv) options, _ = parser.parse_args(argv)
......
...@@ -38,10 +38,7 @@ def PresubmitCheckTestExpectations(input_api, output_api): ...@@ -38,10 +38,7 @@ def PresubmitCheckTestExpectations(input_api, output_api):
os_path.dirname(os_path.abspath(__file__)), '..', '..', os_path.dirname(os_path.abspath(__file__)), '..', '..',
'lint_test_expectations.py') 'lint_test_expectations.py')
_, errs = input_api.subprocess.Popen( _, errs = input_api.subprocess.Popen(
[ [input_api.python_executable, lint_path],
input_api.python_executable, lint_path,
'--no-check-redundant-virtual-expectations'
],
stdout=input_api.subprocess.PIPE, stdout=input_api.subprocess.PIPE,
stderr=input_api.subprocess.PIPE).communicate() stderr=input_api.subprocess.PIPE).communicate()
if not errs: if not errs:
...@@ -54,4 +51,3 @@ def PresubmitCheckTestExpectations(input_api, output_api): ...@@ -54,4 +51,3 @@ def PresubmitCheckTestExpectations(input_api, output_api):
if errs.rstrip().endswith('Lint succeeded with warnings.'): if errs.rstrip().endswith('Lint succeeded with warnings.'):
return [output_api.PresubmitPromptWarning(errs)] return [output_api.PresubmitPromptWarning(errs)]
return [output_api.PresubmitError(errs)] return [output_api.PresubmitError(errs)]
...@@ -345,7 +345,8 @@ class LintTest(LoggingTestCase): ...@@ -345,7 +345,8 @@ class LintTest(LoggingTestCase):
port = host.port_factory.get(options.platform, options=options) port = host.port_factory.get(options.platform, options=options)
port.virtual_test_suites = lambda: [ port.virtual_test_suites = lambda: [
VirtualTestSuite(prefix='foo', bases=['test'], args=['--foo']) VirtualTestSuite(
prefix='foo', bases=['test', 'external/wpt'], args=['--foo'])
] ]
test_expectations = ( test_expectations = (
'# tags: [ mac win ]\n' '# tags: [ mac win ]\n'
...@@ -359,7 +360,11 @@ class LintTest(LoggingTestCase): ...@@ -359,7 +360,11 @@ class LintTest(LoggingTestCase):
'crbug.com/1234 virtual/foo/test/test2.html [ Failure ]\n' 'crbug.com/1234 virtual/foo/test/test2.html [ Failure ]\n'
'test/subtest/test2.html [ Failure ]\n' 'test/subtest/test2.html [ Failure ]\n'
'virtual/foo/test/subtest/* [ Pass ]\n' 'virtual/foo/test/subtest/* [ Pass ]\n'
'virtual/foo/test/subtest/test2.html [ Failure ]') 'virtual/foo/test/subtest/test2.html [ Failure ]\n'
'external/wpt/wpt.html [ Failure ]\n'
# TODO(crbug.com/1080691): This is redundant with the above one, but
# for now we intentially ignore it.
'virtual/foo/external/wpt/wpt.html [ Failure ]\n')
port.expectations_dict = lambda: { port.expectations_dict = lambda: {
'testexpectations': test_expectations 'testexpectations': test_expectations
} }
......
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