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 |
(...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
996 'Possibly invalid OS macro[s] found. Please fix your code\n' | 996 'Possibly invalid OS macro[s] found. Please fix your code\n' |
997 'or add your macro to src/PRESUBMIT.py.', bad_macros)] | 997 'or add your macro to src/PRESUBMIT.py.', bad_macros)] |
998 | 998 |
999 | 999 |
1000 def CheckChangeOnUpload(input_api, output_api): | 1000 def CheckChangeOnUpload(input_api, output_api): |
1001 results = [] | 1001 results = [] |
1002 results.extend(_CommonChecks(input_api, output_api)) | 1002 results.extend(_CommonChecks(input_api, output_api)) |
1003 return results | 1003 return results |
1004 | 1004 |
1005 | 1005 |
1006 def GetDefaultTryConfigs(bots=None): | |
1007 """Returns a list of ('bot', set(['tests']), optionally filtered by [bots]. | |
1008 | |
1009 To add tests to this list, they MUST be in the the corresponding master's | |
1010 gatekeeper config. For example, anything on master.chromium would be closed by | |
1011 /chrome/trunk/tools/build/masters/master.chromium/master_gatekeeper_cfg.py. | |
1012 | |
1013 If 'bots' is specified, will only return configurations for bots in that list. | |
1014 """ | |
1015 | |
1016 standard_tests = [ | |
1017 'base_unittests', | |
1018 'browser_tests', | |
1019 'cacheinvalidation_unittests', | |
1020 'check_deps', | |
1021 'content_browsertests', | |
1022 'content_unittests', | |
1023 'crypto_unittests', | |
1024 #'gfx_unittests', | |
1025 'gpu_unittests', | |
1026 'ipc_tests', | |
1027 'interactive_ui_tests', | |
1028 'jingle_unittests', | |
1029 'media_unittests', | |
1030 'net_unittests', | |
1031 'ppapi_unittests', | |
1032 'printing_unittests', | |
1033 'sql_unittests', | |
1034 'sync_unit_tests', | |
1035 'unit_tests', | |
1036 # Broken in release. | |
1037 #'url_unittests', | |
1038 #'webkit_unit_tests', | |
1039 ] | |
1040 | |
1041 # Use a smaller set of tests for *_aura, since there's a lot of overlap with | |
1042 # the corresponding *_rel builders. | |
1043 # Note: *_aura are Release builders even if their names convey otherwise. | |
1044 aura_tests = [ | |
1045 'app_list_unittests', | |
1046 'aura_unittests', | |
1047 'browser_tests', | |
1048 'compositor_unittests', | |
1049 'content_browsertests', | |
1050 'content_unittests', | |
1051 'interactive_ui_tests', | |
1052 'unit_tests', | |
1053 'views_unittests', | |
1054 ] | |
1055 linux_aura_tests = aura_tests[:] | |
1056 linux_aura_tests.remove('views_unittests') | |
1057 win7_aura_tests = aura_tests[:] | |
1058 win7_aura_tests.remove('app_list_unittests') | |
1059 builders_and_tests = { | |
1060 # TODO(maruel): Figure out a way to run 'sizes' where people can | |
1061 # effectively update the perf expectation correctly. This requires a | |
1062 # clobber=True build running 'sizes'. 'sizes' is not accurate with | |
1063 # incremental build. Reference: | |
1064 # http://chromium.org/developers/tree-sheriffs/perf-sheriffs. | |
1065 # TODO(maruel): An option would be to run 'sizes' but not count a failure | |
1066 # of this step as a try job failure. | |
1067 'android_dbg': ['slave_steps'], | |
1068 'android_clang_dbg': ['slave_steps'], | |
1069 'android_aosp': ['compile'], | |
1070 'ios_dbg_simulator': [ | |
1071 'compile', | |
1072 'base_unittests', | |
1073 'content_unittests', | |
1074 'crypto_unittests', | |
1075 'url_unittests', | |
1076 'net_unittests', | |
1077 'sql_unittests', | |
1078 'ui_unittests', | |
1079 ], | |
1080 'ios_rel_device': ['compile'], | |
1081 'linux_aura': linux_aura_tests, | |
1082 'linux_asan': ['defaulttests'], | |
1083 'linux_clang': ['compile'], | |
1084 'linux_chromeos_clang': ['compile'], | |
1085 # Note: It is a Release builder even if its name convey otherwise. | |
1086 'linux_chromeos': standard_tests + [ | |
1087 'app_list_unittests', | |
1088 'aura_unittests', | |
1089 'ash_unittests', | |
1090 'chromeos_unittests', | |
1091 'components_unittests', | |
1092 'dbus_unittests', | |
1093 'device_unittests', | |
1094 'sandbox_linux_unittests', | |
1095 ], | |
1096 'linux_rel': standard_tests + [ | |
1097 'cc_unittests', | |
1098 'chromedriver2_unittests', | |
1099 'components_unittests', | |
1100 'nacl_integration', | |
1101 'remoting_unittests', | |
1102 'sandbox_linux_unittests', | |
1103 'sync_integration_tests', | |
1104 ], | |
1105 'mac': ['compile'], | |
1106 'mac_rel': standard_tests + [ | |
1107 'app_list_unittests', | |
1108 'cc_unittests', | |
1109 'chromedriver2_unittests', | |
1110 'components_unittests', | |
1111 'google_apis_unittests', | |
1112 'message_center_unittests', | |
1113 'nacl_integration', | |
1114 'remoting_unittests', | |
1115 'sync_integration_tests', | |
1116 'telemetry_unittests', | |
1117 ], | |
1118 'win': ['compile'], | |
1119 'win7_aura': win7_aura_tests + [ | |
1120 'ash_unittests', | |
1121 ], | |
1122 'win_rel': standard_tests + [ | |
1123 'app_list_unittests', | |
1124 'cc_unittests', | |
1125 'chrome_frame_net_tests', | |
1126 'chrome_frame_tests', | |
1127 'chrome_frame_unittests', | |
1128 'chromedriver2_unittests', | |
1129 'components_unittests', | |
1130 'installer_util_unittests', | |
1131 'mini_installer_test', | |
1132 'nacl_integration', | |
1133 'remoting_unittests', | |
1134 'sync_integration_tests', | |
1135 'telemetry_unittests', | |
1136 ], | |
1137 'win_x64_rel': [ | |
1138 'base_unittests', | |
1139 ], | |
1140 } | |
1141 | |
1142 swarm_enabled_builders = ( | |
1143 'linux_rel', | |
1144 'mac_rel', | |
1145 ) | |
1146 | |
1147 swarm_enabled_tests = ( | |
1148 'base_unittests', | |
1149 'browser_tests', | |
1150 'interactive_ui_tests', | |
1151 'net_unittests', | |
1152 'unit_tests', | |
1153 ) | |
1154 | |
1155 for bot in builders_and_tests: | |
1156 if bot in swarm_enabled_builders: | |
1157 builders_and_tests[bot] = [x + '_swarm' if x in swarm_enabled_tests else x | |
1158 for x in builders_and_tests[bot]] | |
1159 | |
1160 if bots: | |
1161 return [(bot, set(builders_and_tests[bot])) for bot in bots] | |
1162 else: | |
1163 return [(bot, set(tests)) for bot, tests in builders_and_tests.iteritems()] | |
1164 | |
1165 | |
1166 def CheckChangeOnCommit(input_api, output_api): | 1006 def CheckChangeOnCommit(input_api, output_api): |
1167 results = [] | 1007 results = [] |
1168 results.extend(_CommonChecks(input_api, output_api)) | 1008 results.extend(_CommonChecks(input_api, output_api)) |
1169 # TODO(thestig) temporarily disabled, doesn't work in third_party/ | 1009 # TODO(thestig) temporarily disabled, doesn't work in third_party/ |
1170 #results.extend(input_api.canned_checks.CheckSvnModifiedDirectories( | 1010 #results.extend(input_api.canned_checks.CheckSvnModifiedDirectories( |
1171 # input_api, output_api, sources)) | 1011 # input_api, output_api, sources)) |
1172 # Make sure the tree is 'open'. | 1012 # Make sure the tree is 'open'. |
1173 results.extend(input_api.canned_checks.CheckTreeIsOpen( | 1013 results.extend(input_api.canned_checks.CheckTreeIsOpen( |
1174 input_api, | 1014 input_api, |
1175 output_api, | 1015 output_api, |
(...skipping 11 matching lines...) Expand all Loading... |
1187 return results | 1027 return results |
1188 | 1028 |
1189 | 1029 |
1190 def GetPreferredTrySlaves(project, change): | 1030 def GetPreferredTrySlaves(project, change): |
1191 files = change.LocalPaths() | 1031 files = change.LocalPaths() |
1192 | 1032 |
1193 if not files or all(re.search(r'[\\/]OWNERS$', f) for f in files): | 1033 if not files or all(re.search(r'[\\/]OWNERS$', f) for f in files): |
1194 return [] | 1034 return [] |
1195 | 1035 |
1196 if all(re.search('\.(m|mm)$|(^|[/_])mac[/_.]', f) for f in files): | 1036 if all(re.search('\.(m|mm)$|(^|[/_])mac[/_.]', f) for f in files): |
1197 return GetDefaultTryConfigs(['mac_rel']) + [ | 1037 return ['mac_rel', 'mac:compile'] |
1198 ('mac', set(['compile']))] | |
1199 if all(re.search('(^|[/_])win[/_.]', f) for f in files): | 1038 if all(re.search('(^|[/_])win[/_.]', f) for f in files): |
1200 return GetDefaultTryConfigs(['win_rel', 'win7_aura']) + [ | 1039 return ['win_rel', 'win7_aura', 'win:compile'] |
1201 ('win', set(['compile']))] | |
1202 if all(re.search('(^|[/_])android[/_.]', f) for f in files): | 1040 if all(re.search('(^|[/_])android[/_.]', f) for f in files): |
1203 return GetDefaultTryConfigs([ | 1041 return ['android_aosp', 'android_dbg', 'android_clang_dbg'] |
1204 'android_aosp', | |
1205 'android_clang_dbg', | |
1206 'android_dbg', | |
1207 ]) | |
1208 if all(re.search('^native_client_sdk', f) for f in files): | 1042 if all(re.search('^native_client_sdk', f) for f in files): |
1209 return GetDefaultTryConfigs([ | 1043 return ['linux_nacl_sdk', 'win_nacl_sdk', 'mac_nacl_sdk'] |
1210 'linux_nacl_sdk', | |
1211 'mac_nacl_sdk', | |
1212 'win_nacl_sdk', | |
1213 ]) | |
1214 if all(re.search('[/_]ios[/_.]', f) for f in files): | 1044 if all(re.search('[/_]ios[/_.]', f) for f in files): |
1215 return GetDefaultTryConfigs(['ios_rel_device', 'ios_dbg_simulator']) | 1045 return ['ios_rel_device', 'ios_dbg_simulator'] |
1216 | 1046 |
1217 trybots = GetDefaultTryConfigs([ | 1047 trybots = [ |
1218 'android_clang_dbg', | 1048 'android_clang_dbg', |
1219 'android_dbg', | 1049 'android_dbg', |
1220 'ios_dbg_simulator', | 1050 'ios_dbg_simulator', |
1221 'ios_rel_device', | 1051 'ios_rel_device', |
1222 'linux_asan', | 1052 'linux_asan', |
1223 'linux_aura', | 1053 'linux_aura', |
1224 'linux_chromeos', | 1054 'linux_chromeos', |
1225 'linux_clang', | 1055 'linux_clang:compile', |
1226 'linux_rel', | 1056 'linux_rel', |
1227 'mac', | |
1228 'mac_rel', | 1057 'mac_rel', |
1229 'win', | 1058 'mac:compile', |
1230 'win7_aura', | 1059 'win7_aura', |
1231 'win_rel', | 1060 'win_rel', |
1232 'win_x64_rel', | 1061 'win:compile', |
1233 ]) | 1062 'win_x64_rel:base_unittests', |
| 1063 ] |
1234 | 1064 |
1235 # Match things like path/aura/file.cc and path/file_aura.cc. | 1065 # Match things like path/aura/file.cc and path/file_aura.cc. |
1236 # Same for chromeos. | 1066 # Same for chromeos. |
1237 if any(re.search('[/_](aura|chromeos)', f) for f in files): | 1067 if any(re.search('[/_](aura|chromeos)', f) for f in files): |
1238 trybots.extend(GetDefaultTryConfigs(['linux_chromeos_clang'])) | 1068 trybots += ['linux_chromeos_clang:compile', 'linux_chromeos_asan'] |
1239 trybots.append(('linux_chromeos_asan', set(['defaulttests']))) | |
1240 | 1069 |
1241 # If there are gyp changes to base, build, or chromeos, run a full cros build | 1070 # If there are gyp changes to base, build, or chromeos, run a full cros build |
1242 # in addition to the shorter linux_chromeos build. Changes to high level gyp | 1071 # in addition to the shorter linux_chromeos build. Changes to high level gyp |
1243 # files have a much higher chance of breaking the cros build, which is | 1072 # files have a much higher chance of breaking the cros build, which is |
1244 # differnt from the linux_chromeos build that most chrome developers test | 1073 # differnt from the linux_chromeos build that most chrome developers test |
1245 # with. | 1074 # with. |
1246 if any(re.search('^(base|build|chromeos).*\.gypi?$', f) for f in files): | 1075 if any(re.search('^(base|build|chromeos).*\.gypi?$', f) for f in files): |
1247 trybots.append(('cros_x86', set(['defaulttests']))) | 1076 trybots += ['cros_x86'] |
1248 | 1077 |
1249 # The AOSP bot doesn't build the chrome/ layer, so ignore any changes to it | 1078 # The AOSP bot doesn't build the chrome/ layer, so ignore any changes to it |
1250 # unless they're .gyp(i) files as changes to those files can break the gyp | 1079 # unless they're .gyp(i) files as changes to those files can break the gyp |
1251 # step on that bot. | 1080 # step on that bot. |
1252 if (not all(re.search('^chrome', f) for f in files) or | 1081 if (not all(re.search('^chrome', f) for f in files) or |
1253 any(re.search('\.gypi?$', f) for f in files)): | 1082 any(re.search('\.gypi?$', f) for f in files)): |
1254 trybots.extend(GetDefaultTryConfigs(['android_aosp'])) | 1083 trybots += ['android_aosp'] |
1255 | 1084 |
1256 return trybots | 1085 return trybots |
OLD | NEW |