[nnbd] Make PRESUBMIT.py warn on upload if tests are not changed in NNBD and non-NNBD suites

This CL ensures that the presubmit check will complain if newly added
tests were only added to NNBD suite but not to non-NNBD (or vice versa).

Also add ffi test suites to the list of checked directories.

Change-Id: I090064b99e5ca30444ab53edf1f262572f60beb9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149426
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
This commit is contained in:
Martin Kustermann 2020-05-30 08:05:11 +00:00 committed by commit-bot@chromium.org
parent 439e99483f
commit e50a064034

View file

@ -67,7 +67,7 @@ def _CheckNnbdTestSync(input_api, output_api):
a test, the test's counterpart (if it exists at all) should be in the CL
too.
"""
DIRS = ["co19", "corelib", "language", "lib", "standalone"]
DIRS = ["co19", "corelib", "ffi", "language", "lib", "standalone"]
files = [git_file.LocalPath() for git_file in input_api.AffectedTextFiles()]
unsynchronized = []
@ -83,19 +83,14 @@ def _CheckNnbdTestSync(input_api, output_api):
counterpart = file.replace(nnbd_dir, legacy_dir)
if counterpart:
# Changed one file with a potential counterpart. If it exists
# on disc, make sure it is also in the CL.
if counterpart not in files and os.path.exists(counterpart):
unsynchronized.append("- {} -> {}".format(
file, counterpart))
# Changed one file with a potential counterpart.
if counterpart not in files:
missing = '' if os.path.exists(
counterpart) else ' (missing)'
unsynchronized.append("- {} -> {}{}".format(
file, counterpart, missing))
break
# TODO(rnystrom): Currently, we only warn if a test does exist in both
# places on disc but only one is touched by a CL. We don't warn for files
# that only exist on one side because the migration isn't complete and the
# CL may be migrating. Once the migration is complete, consider making
# these checks more rigorous.
if unsynchronized:
return [
output_api.PresubmitPromptWarning(