OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Top-level presubmit script for Chromium. | 5 """Top-level presubmit script for Chromium. |
6 | 6 |
7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts | 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts |
8 for more details about the presubmit API built into gcl. | 8 for more details about the presubmit API built into gcl. |
9 """ | 9 """ |
10 | 10 |
11 | 11 |
12 import re | 12 import re |
13 import subprocess | 13 import subprocess |
14 import sys | 14 import sys |
15 | 15 |
16 | 16 |
17 _EXCLUDED_PATHS = ( | 17 _EXCLUDED_PATHS = ( |
18 r"^breakpad[\\\/].*", | 18 r"^breakpad[\\\/].*", |
19 r"^native_client_sdk[\\\/]src[\\\/]build_tools[\\\/]make_rules.py", | 19 r"^native_client_sdk[\\\/]src[\\\/]build_tools[\\\/]make_rules.py", |
20 r"^native_client_sdk[\\\/]src[\\\/]build_tools[\\\/]make_simple.py", | 20 r"^native_client_sdk[\\\/]src[\\\/]build_tools[\\\/]make_simple.py", |
21 r"^native_client_sdk[\\\/]src[\\\/]tools[\\\/].*.mk", | 21 r"^native_client_sdk[\\\/]src[\\\/]tools[\\\/].*.mk", |
22 r"^net[\\\/]tools[\\\/]spdyshark[\\\/].*", | 22 r"^net[\\\/]tools[\\\/]spdyshark[\\\/].*", |
23 r"^skia[\\\/].*", | 23 r"^skia[\\\/].*", |
24 r"^v8[\\\/].*", | 24 r"^v8[\\\/].*", |
25 r".*MakeFile$", | 25 r".*MakeFile$", |
26 r".+_autogen\.h$", | 26 r".+_autogen\.h$", |
27 r".+[\\\/]pnacl_shim\.c$", | 27 r".+[\\\/]pnacl_shim\.c$", |
28 ) | 28 ) |
29 | 29 |
30 # Fragment of a regular expression that matches file name suffixes | |
31 # used to indicate different platforms. | |
32 _PLATFORM_SPECIFIERS = r'(_(android|chromeos|gtk|mac|posix|win))?' | |
33 | |
34 # Fragment of a regular expression that matches C++ and Objective-C++ | 30 # Fragment of a regular expression that matches C++ and Objective-C++ |
35 # implementation files. | 31 # implementation files. |
36 _IMPLEMENTATION_EXTENSIONS = r'\.(cc|cpp|cxx|mm)$' | 32 _IMPLEMENTATION_EXTENSIONS = r'\.(cc|cpp|cxx|mm)$' |
37 | 33 |
38 # Regular expression that matches code only used for test binaries | 34 # Regular expression that matches code only used for test binaries |
39 # (best effort). | 35 # (best effort). |
40 _TEST_CODE_EXCLUDED_PATHS = ( | 36 _TEST_CODE_EXCLUDED_PATHS = ( |
41 r'.*[/\\](fake_|test_|mock_).+%s' % _IMPLEMENTATION_EXTENSIONS, | 37 r'.*[/\\](fake_|test_|mock_).+%s' % _IMPLEMENTATION_EXTENSIONS, |
42 r'.+_test_(base|support|util)%s' % _IMPLEMENTATION_EXTENSIONS, | 38 r'.+_test_(base|support|util)%s' % _IMPLEMENTATION_EXTENSIONS, |
43 r'.+_(api|browser|perf|unit|ui)?test%s%s' % (_PLATFORM_SPECIFIERS, | 39 r'.+_(api|browser|perf|unit|ui)?test(_[a-z]+)?%s' % |
44 _IMPLEMENTATION_EXTENSIONS), | 40 _IMPLEMENTATION_EXTENSIONS, |
45 r'.+profile_sync_service_harness%s' % _IMPLEMENTATION_EXTENSIONS, | 41 r'.+profile_sync_service_harness%s' % _IMPLEMENTATION_EXTENSIONS, |
46 r'.*[/\\](test|tool(s)?)[/\\].*', | 42 r'.*[/\\](test|tool(s)?)[/\\].*', |
47 # At request of folks maintaining this folder. | 43 # At request of folks maintaining this folder. |
48 r'chrome[/\\]browser[/\\]automation[/\\].*', | 44 r'chrome[/\\]browser[/\\]automation[/\\].*', |
49 ) | 45 ) |
50 | 46 |
51 _TEST_ONLY_WARNING = ( | 47 _TEST_ONLY_WARNING = ( |
52 'You might be calling functions intended only for testing from\n' | 48 'You might be calling functions intended only for testing from\n' |
53 'production code. It is OK to ignore this warning if you know what\n' | 49 'production code. It is OK to ignore this warning if you know what\n' |
54 'you are doing, as the heuristics used to detect the situation are\n' | 50 'you are doing, as the heuristics used to detect the situation are\n' |
(...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
918 'win_rel', | 914 'win_rel', |
919 'win:compile', | 915 'win:compile', |
920 ] | 916 ] |
921 | 917 |
922 # Match things like path/aura/file.cc and path/file_aura.cc. | 918 # Match things like path/aura/file.cc and path/file_aura.cc. |
923 # Same for chromeos. | 919 # Same for chromeos. |
924 if any(re.search('[/_](aura|chromeos)', f) for f in files): | 920 if any(re.search('[/_](aura|chromeos)', f) for f in files): |
925 trybots += ['linux_chromeos_clang:compile', 'linux_chromeos_asan'] | 921 trybots += ['linux_chromeos_clang:compile', 'linux_chromeos_asan'] |
926 | 922 |
927 return trybots | 923 return trybots |
OLD | NEW |