diff options
author | Ben Murdoch <benm@google.com> | 2016-03-22 12:00:34 +0000 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2016-04-05 15:27:36 +0100 |
commit | 014dc512cdd3e367bee49a713fdc5ed92584a3e5 (patch) | |
tree | 742b8bb81c9998b13f6a801f8e0bec6ae9a568c1 /PRESUBMIT.py | |
parent | 094c92c64194bd11593e915f372914dcfccf9dd2 (diff) | |
download | v8-014dc512cdd3e367bee49a713fdc5ed92584a3e5.tar.gz |
Upgrade V8 to version 4.9.385.28
https://chromium.googlesource.com/v8/v8/+/4.9.385.28
Change-Id: I4b2e74289d4bf3667f2f3dc8aa2e541f63e26eb4
Diffstat (limited to 'PRESUBMIT.py')
-rw-r--r-- | PRESUBMIT.py | 87 |
1 files changed, 54 insertions, 33 deletions
diff --git a/PRESUBMIT.py b/PRESUBMIT.py index 6d19a4e5..f8516afc 100644 --- a/PRESUBMIT.py +++ b/PRESUBMIT.py @@ -67,8 +67,9 @@ def _V8PresubmitChecks(input_api, output_api): input_api.PresubmitLocalPath(), 'tools')) from presubmit import CppLintProcessor from presubmit import SourceProcessor - from presubmit import CheckRuntimeVsNativesNameClashes from presubmit import CheckExternalReferenceRegistration + from presubmit import CheckAuthorizedAuthor + from presubmit import CheckStatusFiles results = [] if not CppLintProcessor().Run(input_api.PresubmitLocalPath()): @@ -77,12 +78,12 @@ def _V8PresubmitChecks(input_api, output_api): results.append(output_api.PresubmitError( "Copyright header, trailing whitespaces and two empty lines " \ "between declarations check failed")) - if not CheckRuntimeVsNativesNameClashes(input_api.PresubmitLocalPath()): - results.append(output_api.PresubmitError( - "Runtime/natives name clash check failed")) if not CheckExternalReferenceRegistration(input_api.PresubmitLocalPath()): results.append(output_api.PresubmitError( "External references registration check failed")) + if not CheckStatusFiles(input_api.PresubmitLocalPath()): + results.append(output_api.PresubmitError("Status file check failed")) + results.extend(CheckAuthorizedAuthor(input_api, output_api)) return results @@ -139,6 +140,39 @@ def _CheckUnwantedDependencies(input_api, output_api): return results +def _CheckNoInlineHeaderIncludesInNormalHeaders(input_api, output_api): + """Attempts to prevent inclusion of inline headers into normal header + files. This tries to establish a layering where inline headers can be + included by other inline headers or compilation units only.""" + file_inclusion_pattern = r'(?!.+-inl\.h).+\.h' + include_directive_pattern = input_api.re.compile(r'#include ".+-inl.h"') + include_warning = ( + 'You might be including an inline header (e.g. foo-inl.h) within a\n' + 'normal header (e.g. bar.h) file. Can you avoid introducing the\n' + '#include? The commit queue will not block on this warning.') + + def FilterFile(affected_file): + black_list = (_EXCLUDED_PATHS + + input_api.DEFAULT_BLACK_LIST) + return input_api.FilterSourceFile( + affected_file, + white_list=(file_inclusion_pattern, ), + black_list=black_list) + + problems = [] + for f in input_api.AffectedSourceFiles(FilterFile): + local_path = f.LocalPath() + for line_number, line in f.ChangedContents(): + if (include_directive_pattern.search(line)): + problems.append( + '%s:%d\n %s' % (local_path, line_number, line.strip())) + + if problems: + return [output_api.PresubmitPromptOrNotify(include_warning, problems)] + else: + return [] + + def _CheckNoProductionCodeUsingTestOnlyFunctions(input_api, output_api): """Attempts to prevent use of functions intended only for testing in non-testing code. For now this is just a best-effort implementation @@ -193,42 +227,47 @@ def _CommonChecks(input_api, output_api): results.extend(_CheckUnwantedDependencies(input_api, output_api)) results.extend( _CheckNoProductionCodeUsingTestOnlyFunctions(input_api, output_api)) + results.extend( + _CheckNoInlineHeaderIncludesInNormalHeaders(input_api, output_api)) return results def _SkipTreeCheck(input_api, output_api): """Check the env var whether we want to skip tree check. - Only skip if src/version.cc has been updated.""" - src_version = 'src/version.cc' - FilterFile = lambda file: file.LocalPath() == src_version + Only skip if include/v8-version.h has been updated.""" + src_version = 'include/v8-version.h' if not input_api.AffectedSourceFiles( lambda file: file.LocalPath() == src_version): return False return input_api.environ.get('PRESUBMIT_TREE_CHECK') == 'skip' -def _CheckChangeLogFlag(input_api, output_api): +def _CheckChangeLogFlag(input_api, output_api, warn): """Checks usage of LOG= flag in the commit message.""" results = [] - if input_api.change.BUG and not 'LOG' in input_api.change.tags: - results.append(output_api.PresubmitError( - 'An issue reference (BUG=) requires a change log flag (LOG=). ' - 'Use LOG=Y for including this commit message in the change log. ' - 'Use LOG=N or leave blank otherwise.')) + if (input_api.change.BUG and input_api.change.BUG != 'none' and + not 'LOG' in input_api.change.tags): + text = ('An issue reference (BUG=) requires a change log flag (LOG=). ' + 'Use LOG=Y for including this commit message in the change log. ' + 'Use LOG=N or leave blank otherwise.') + if warn: + results.append(output_api.PresubmitPromptWarning(text)) + else: + results.append(output_api.PresubmitError(text)) return results def CheckChangeOnUpload(input_api, output_api): results = [] results.extend(_CommonChecks(input_api, output_api)) - results.extend(_CheckChangeLogFlag(input_api, output_api)) + results.extend(_CheckChangeLogFlag(input_api, output_api, True)) return results def CheckChangeOnCommit(input_api, output_api): results = [] results.extend(_CommonChecks(input_api, output_api)) - results.extend(_CheckChangeLogFlag(input_api, output_api)) + results.extend(_CheckChangeLogFlag(input_api, output_api, False)) results.extend(input_api.canned_checks.CheckChangeHasDescription( input_api, output_api)) if not _SkipTreeCheck(input_api, output_api): @@ -236,21 +275,3 @@ def CheckChangeOnCommit(input_api, output_api): input_api, output_api, json_url='http://v8-status.appspot.com/current?format=json')) return results - - -def GetPreferredTryMasters(project, change): - return { - 'tryserver.v8': { - 'v8_linux_rel': set(['defaulttests']), - 'v8_linux_dbg': set(['defaulttests']), - 'v8_linux_nosnap_rel': set(['defaulttests']), - 'v8_linux64_rel': set(['defaulttests']), - 'v8_linux_arm_dbg': set(['defaulttests']), - 'v8_linux_arm64_rel': set(['defaulttests']), - 'v8_linux_layout_dbg': set(['defaulttests']), - 'v8_linux_chromium_gn_rel': set(['defaulttests']), - 'v8_mac_rel': set(['defaulttests']), - 'v8_win_rel': set(['defaulttests']), - 'v8_win64_compile_rel': set(['defaulttests']), - }, - } |