summaryrefslogtreecommitdiff
path: root/chromium/PRESUBMIT.py
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2017-07-12 14:07:37 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2017-07-17 10:29:26 +0000
commitec02ee4181c49b61fce1c8fb99292dbb8139cc90 (patch)
tree25cde714b2b71eb639d1cd53f5a22e9ba76e14ef /chromium/PRESUBMIT.py
parentbb09965444b5bb20b096a291445170876225268d (diff)
downloadqtwebengine-chromium-ec02ee4181c49b61fce1c8fb99292dbb8139cc90.tar.gz
BASELINE: Update Chromium to 59.0.3071.134
Change-Id: Id02ef6fb2204c5fd21668a1c3e6911c83b17585a Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'chromium/PRESUBMIT.py')
-rw-r--r--chromium/PRESUBMIT.py74
1 files changed, 52 insertions, 22 deletions
diff --git a/chromium/PRESUBMIT.py b/chromium/PRESUBMIT.py
index 5454bba3043..ce91a438334 100644
--- a/chromium/PRESUBMIT.py
+++ b/chromium/PRESUBMIT.py
@@ -25,6 +25,9 @@ _EXCLUDED_PATHS = (
r"^chrome[\\\/]browser[\\\/]resources[\\\/]pdf[\\\/]index.js",
r".*vulcanized.html$",
r".*crisper.js$",
+ r"tools[\\\/]md_browser[\\\/].*\.css$",
+ # Test pages for WebRTC telemetry tests.
+ r"tools[\\\/]perf[\\\/]page_sets[\\\/]webrtc_cases.*",
)
@@ -154,6 +157,14 @@ _BANNED_CPP_FUNCTIONS = (
# FRIEND_TEST_ALL_PREFIXES() macro from base/gtest_prod_util.h should be
# used instead since that allows for FLAKY_ and DISABLED_ prefixes.
(
+ r'\bNULL\b',
+ (
+ 'New code should not use NULL. Use nullptr instead.',
+ ),
+ True,
+ (),
+ ),
+ (
'FRIEND_TEST(',
(
'Chromium code should not use gtest\'s FRIEND_TEST() macro. Include',
@@ -185,6 +196,7 @@ _BANNED_CPP_FUNCTIONS = (
),
True,
(
+ r"^base[\\\/]memory[\\\/]shared_memory_posix\.cc$",
r"^base[\\\/]process[\\\/]process_linux\.cc$",
r"^base[\\\/]process[\\\/]process_metrics_linux\.cc$",
r"^chrome[\\\/]browser[\\\/]chromeos[\\\/]boot_times_recorder\.cc$",
@@ -338,6 +350,7 @@ _VALID_OS_MACROS = (
_ANDROID_SPECIFIC_PYDEPS_FILES = [
'build/android/test_runner.pydeps',
+ 'build/android/test_wrapper/logdog_wrapper.pydeps',
'net/tools/testserver/testserver.pydeps',
]
@@ -677,7 +690,7 @@ def _CheckNoTrinaryTrueFalse(input_api, output_api):
def _CheckUnwantedDependencies(input_api, output_api):
- """Runs checkdeps on #include statements added in this
+ """Runs checkdeps on #include and import statements added in this
change. Breaking - rules is an error, breaking ! rules is a
warning.
"""
@@ -691,41 +704,60 @@ def _CheckUnwantedDependencies(input_api, output_api):
input_api.PresubmitLocalPath(), 'buildtools', 'checkdeps')]
import checkdeps
from cpp_checker import CppChecker
+ from proto_checker import ProtoChecker
from rules import Rule
finally:
# Restore sys.path to what it was before.
sys.path = original_sys_path
added_includes = []
+ added_imports = []
for f in input_api.AffectedFiles():
- if not CppChecker.IsCppFile(f.LocalPath()):
- continue
-
- changed_lines = [line for line_num, line in f.ChangedContents()]
- added_includes.append([f.LocalPath(), changed_lines])
+ if CppChecker.IsCppFile(f.LocalPath()):
+ changed_lines = [line for line_num, line in f.ChangedContents()]
+ added_includes.append([f.LocalPath(), changed_lines])
+ elif ProtoChecker.IsProtoFile(f.LocalPath()):
+ changed_lines = [line for line_num, line in f.ChangedContents()]
+ added_imports.append([f.LocalPath(), changed_lines])
deps_checker = checkdeps.DepsChecker(input_api.PresubmitLocalPath())
error_descriptions = []
warning_descriptions = []
+ error_subjects = set()
+ warning_subjects = set()
for path, rule_type, rule_description in deps_checker.CheckAddedCppIncludes(
added_includes):
description_with_path = '%s\n %s' % (path, rule_description)
if rule_type == Rule.DISALLOW:
error_descriptions.append(description_with_path)
+ error_subjects.add("#includes")
else:
warning_descriptions.append(description_with_path)
+ warning_subjects.add("#includes")
+
+ for path, rule_type, rule_description in deps_checker.CheckAddedProtoImports(
+ added_imports):
+ description_with_path = '%s\n %s' % (path, rule_description)
+ if rule_type == Rule.DISALLOW:
+ error_descriptions.append(description_with_path)
+ error_subjects.add("imports")
+ else:
+ warning_descriptions.append(description_with_path)
+ warning_subjects.add("imports")
results = []
if error_descriptions:
results.append(output_api.PresubmitError(
- 'You added one or more #includes that violate checkdeps rules.',
+ 'You added one or more %s that violate checkdeps rules.'
+ % " and ".join(error_subjects),
error_descriptions))
if warning_descriptions:
results.append(output_api.PresubmitPromptOrNotify(
- 'You added one or more #includes of files that are temporarily\n'
+ 'You added one or more %s of files that are temporarily\n'
'allowed but being removed. Can you avoid introducing the\n'
- '#include? See relevant DEPS file(s) for details and contacts.',
+ '%s? See relevant DEPS file(s) for details and contacts.' %
+ (" and ".join(warning_subjects), "/".join(warning_subjects)),
warning_descriptions))
return results
@@ -1200,20 +1232,20 @@ def _CheckSpamLogging(input_api, output_api):
source_file_filter = lambda x: input_api.FilterSourceFile(
x, white_list=(file_inclusion_pattern,), black_list=black_list)
- log_info = []
- printf = []
+ log_info = set([])
+ printf = set([])
for f in input_api.AffectedSourceFiles(source_file_filter):
- contents = input_api.ReadFile(f, 'rb')
- if input_api.re.search(r"\bD?LOG\s*\(\s*INFO\s*\)", contents):
- log_info.append(f.LocalPath())
- elif input_api.re.search(r"\bD?LOG_IF\s*\(\s*INFO\s*,", contents):
- log_info.append(f.LocalPath())
+ for _, line in f.ChangedContents():
+ if input_api.re.search(r"\bD?LOG\s*\(\s*INFO\s*\)", line):
+ log_info.add(f.LocalPath())
+ elif input_api.re.search(r"\bD?LOG_IF\s*\(\s*INFO\s*,", line):
+ log_info.add(f.LocalPath())
- if input_api.re.search(r"\bprintf\(", contents):
- printf.append(f.LocalPath())
- elif input_api.re.search(r"\bfprintf\((stdout|stderr)", contents):
- printf.append(f.LocalPath())
+ if input_api.re.search(r"\bprintf\(", line):
+ printf.add(f.LocalPath())
+ elif input_api.re.search(r"\bfprintf\((stdout|stderr)", line):
+ printf.add(f.LocalPath())
if log_info:
return [output_api.PresubmitError(
@@ -2320,8 +2352,6 @@ def CheckChangeOnUpload(input_api, output_api):
results.extend(_CheckValidHostsInDEPS(input_api, output_api))
results.extend(
input_api.canned_checks.CheckPatchFormatted(input_api, output_api))
- results.extend(
- input_api.canned_checks.CheckGNFormatted(input_api, output_api))
results.extend(_CheckUmaHistogramChanges(input_api, output_api))
results.extend(_AndroidSpecificOnUploadChecks(input_api, output_api))
results.extend(_CheckSyslogUseWarning(input_api, output_api))