Commit 7db00923 authored by Rakib M. Hasan's avatar Rakib M. Hasan Committed by Commit Bot

wpt, blinkpy: Change lint for detecting deleted tests in Android

expectations files to warning

wpt_expectations_updater.py does not account for renamed or deleted
generated tests when cleaning up affected tests from expectations
during WPT imports. The wpt-importer only cleans up expectations
for physical tests that were renamed or deleted in a CL. We will
temporarily change this linter condition to a warning, until we can
detect renamed or deleted generated tests in expectations for CL's.

TBR=robertma@chromium.org

Bug: 1110003
Change-Id: I4fcfddc5528d8591d56e10f84c752e7e460b706b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2321057Reviewed-by: default avatarRakib Hasan <rmhasan@google.com>
Reviewed-by: default avatarLuke Z <lpz@chromium.org>
Commit-Queue: Rakib Hasan <rmhasan@google.com>
Cr-Commit-Position: refs/heads/master@{#792399}
parent 8034450f
......@@ -109,7 +109,7 @@ def lint(host, options):
failures.append(str(error))
_log.error('')
if any('Test does not exist' in f for f in failures):
if any('Test does not exist' in w for w in warnings):
# TODO(rmhasan): Instead of hardcoding '--android-product=ANDROID_WEBLAYER'
# add a general --android command line argument which will be used to
# put wpt_update_expectations.py into Android mode.
......@@ -152,6 +152,7 @@ def _check_expectations_file_content(content):
def _check_test_existence(host, port, path, expectations, wpt_tests):
failures = []
warnings = []
is_android_path = path in PRODUCTS_TO_EXPECTATION_FILE_PATHS.values()
for exp in expectations:
if not exp.test:
......@@ -164,13 +165,19 @@ def _check_test_existence(host, port, path, expectations, wpt_tests):
test_name = exp.test[:-1]
else:
test_name = exp.test
if (is_android_path and test_name not in wpt_tests or
not is_android_path and not port.test_exists(test_name)):
error = "{}:{} Test does not exist: {}".format(
host.filesystem.basename(path), exp.lineno, exp.test)
_log.error(error)
failures.append(error)
return failures
possible_error = "{}:{} Test does not exist: {}".format(
host.filesystem.basename(path), exp.lineno, exp.test)
if is_android_path and test_name not in wpt_tests:
# TODO(crbug.com/1110003): Change this lint back into a failure
# after figuring out how to clean up renamed or deleted generated
# tests from expectations files when wpt_update_expectations.py is
# run with the --clean-up-affected-tests-only command line argument.
warnings.append(possible_error)
_log.warning(possible_error)
elif not is_android_path and not port.test_exists(test_name):
failures.append(possible_error)
_log.error(possible_error)
return failures, warnings
def _check_directory_glob(host, port, path, expectations):
......@@ -287,7 +294,8 @@ def _check_expectations(host, port, path, test_expectations, options, wpt_tests)
# Check for original expectation lines (from get_updated_lines) instead of
# expectations filtered for the current port (test_expectations).
expectations = test_expectations.get_updated_lines(path)
failures = _check_test_existence(host, port, path, expectations, wpt_tests)
failures, warnings = _check_test_existence(
host, port, path, expectations, wpt_tests)
failures.extend(_check_directory_glob(host, port, path, expectations))
failures.extend(_check_never_fix_tests(host, port, path, expectations))
if path in PRODUCTS_TO_EXPECTATION_FILE_PATHS.values():
......@@ -295,7 +303,6 @@ def _check_expectations(host, port, path, test_expectations, options, wpt_tests)
host, port, path, expectations))
# TODO(crbug.com/1080691): Change this to failures once
# wpt_expectations_updater is fixed.
warnings = []
if not getattr(options, 'no_check_redundant_virtual_expectations', False):
warnings.extend(
_check_redundant_virtual_expectations(host, port, path,
......
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