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): ...@@ -109,7 +109,7 @@ def lint(host, options):
failures.append(str(error)) failures.append(str(error))
_log.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' # TODO(rmhasan): Instead of hardcoding '--android-product=ANDROID_WEBLAYER'
# add a general --android command line argument which will be used to # add a general --android command line argument which will be used to
# put wpt_update_expectations.py into Android mode. # put wpt_update_expectations.py into Android mode.
...@@ -152,6 +152,7 @@ def _check_expectations_file_content(content): ...@@ -152,6 +152,7 @@ def _check_expectations_file_content(content):
def _check_test_existence(host, port, path, expectations, wpt_tests): def _check_test_existence(host, port, path, expectations, wpt_tests):
failures = [] failures = []
warnings = []
is_android_path = path in PRODUCTS_TO_EXPECTATION_FILE_PATHS.values() is_android_path = path in PRODUCTS_TO_EXPECTATION_FILE_PATHS.values()
for exp in expectations: for exp in expectations:
if not exp.test: if not exp.test:
...@@ -164,13 +165,19 @@ def _check_test_existence(host, port, path, expectations, wpt_tests): ...@@ -164,13 +165,19 @@ def _check_test_existence(host, port, path, expectations, wpt_tests):
test_name = exp.test[:-1] test_name = exp.test[:-1]
else: else:
test_name = exp.test test_name = exp.test
if (is_android_path and test_name not in wpt_tests or possible_error = "{}:{} Test does not exist: {}".format(
not is_android_path and not port.test_exists(test_name)): host.filesystem.basename(path), exp.lineno, exp.test)
error = "{}:{} Test does not exist: {}".format( if is_android_path and test_name not in wpt_tests:
host.filesystem.basename(path), exp.lineno, exp.test) # TODO(crbug.com/1110003): Change this lint back into a failure
_log.error(error) # after figuring out how to clean up renamed or deleted generated
failures.append(error) # tests from expectations files when wpt_update_expectations.py is
return failures # 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): def _check_directory_glob(host, port, path, expectations):
...@@ -287,7 +294,8 @@ def _check_expectations(host, port, path, test_expectations, options, wpt_tests) ...@@ -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 # 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)
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_directory_glob(host, port, path, expectations))
failures.extend(_check_never_fix_tests(host, port, path, expectations)) failures.extend(_check_never_fix_tests(host, port, path, expectations))
if path in PRODUCTS_TO_EXPECTATION_FILE_PATHS.values(): if path in PRODUCTS_TO_EXPECTATION_FILE_PATHS.values():
...@@ -295,7 +303,6 @@ def _check_expectations(host, port, path, test_expectations, options, wpt_tests) ...@@ -295,7 +303,6 @@ 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.
warnings = []
if not getattr(options, 'no_check_redundant_virtual_expectations', False): 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,
......
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