Commit 1e687202 authored by Xianzhu Wang's avatar Xianzhu Wang Committed by Commit Bot

Don't check for redundant virtual expectations during presubmit

Because of crbug.com/1080691, WPT import constantly adds redundant
virtual expectations, and the warnings (though not errors) are
annoying to most developers.

Actually the virtual fallback feature was to relieve burden of
sheriffs and developers for adding duplicated virtual and base
expectations. Preventing redundant expectations is not the main goal.
Existing redundant expectations are not very harmful.

Bug: 1080691
Change-Id: Id0a4ac931d417a223d337cd260aba47ddd74395f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2227454
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Auto-Submit: Xianzhu Wang <wangxianzhu@chromium.org>
Reviewed-by: default avatarRobert Ma <robertma@chromium.org>
Cr-Commit-Position: refs/heads/master@{#774730}
parent 3edfaa5d
...@@ -48,7 +48,10 @@ def PresubmitCheckTestExpectations(input_api, output_api): ...@@ -48,7 +48,10 @@ 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:
...@@ -125,7 +128,7 @@ def lint(host, options): ...@@ -125,7 +128,7 @@ def lint(host, options):
ports_to_lint[0], expectations_dict={path: content}) ports_to_lint[0], expectations_dict={path: content})
# Check each expectation for issues # Check each expectation for issues
f, w = _check_expectations(host, ports_to_lint[0], path, f, w = _check_expectations(host, ports_to_lint[0], path,
test_expectations) test_expectations, options)
failures += f failures += f
warnings += w warnings += w
except ParseError as error: except ParseError as error:
...@@ -246,7 +249,7 @@ def _check_redundant_virtual_expectations(host, port, path, expectations): ...@@ -246,7 +249,7 @@ def _check_redundant_virtual_expectations(host, port, path, expectations):
return failures return failures
def _check_expectations(host, port, path, test_expectations): def _check_expectations(host, port, path, test_expectations, options):
# Check for original expectation lines (from get_updated_lines) instead of # Check for original expectation lines (from get_updated_lines) instead of
# expectations filtered for the current port (test_expectations). # expectations filtered for the current port (test_expectations).
expectations = test_expectations.get_updated_lines(path) expectations = test_expectations.get_updated_lines(path)
...@@ -254,8 +257,11 @@ def _check_expectations(host, port, path, test_expectations): ...@@ -254,8 +257,11 @@ def _check_expectations(host, port, path, test_expectations):
failures.extend(_check_directory_glob(host, port, path, expectations)) failures.extend(_check_directory_glob(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.
warnings = _check_redundant_virtual_expectations(host, port, path, warnings = []
expectations) if not getattr(options, 'no_check_redundant_virtual_expectations', False):
warnings.extend(
_check_redundant_virtual_expectations(host, port, path,
expectations))
return failures, warnings return failures, warnings
...@@ -387,6 +393,10 @@ def main(argv, stderr, host=None): ...@@ -387,6 +393,10 @@ 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)
......
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