| OLD | NEW |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 import re | 5 import re |
| 6 | 6 |
| 7 DEPS = [ | 7 DEPS = [ |
| 8 'bot_update', | 8 'bot_update', |
| 9 'chromium', | 9 'chromium', |
| 10 'chromium_tests', | 10 'chromium_tests', |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 | 510 |
| 511 | 511 |
| 512 def should_filter_tests(name, regexs): | 512 def should_filter_tests(name, regexs): |
| 513 """Returns true if the builder |name| should filter the sets of tests. | 513 """Returns true if the builder |name| should filter the sets of tests. |
| 514 |regexs| is a list of the regular expressions specifying the builders that | 514 |regexs| is a list of the regular expressions specifying the builders that |
| 515 should *not* be filtered. If |name| completely matches one of the regular | 515 should *not* be filtered. If |name| completely matches one of the regular |
| 516 expressions than false is returned, otherwise true.""" | 516 expressions than false is returned, otherwise true.""" |
| 517 return not does_regex_match(name, regexs) | 517 return not does_regex_match(name, regexs) |
| 518 | 518 |
| 519 | 519 |
| 520 def should_filter_compile(name, regexs): |
| 521 """Returns true if the builder |name| should filter the sets of compile |
| 522 targets. |regexs| is a list of the regular expressions specifying the |
| 523 builders that should *not* be filtered. If |name| completely matches one of |
| 524 the regular expressions than false is returned, otherwise true.""" |
| 525 return not does_regex_match(name, regexs) |
| 526 |
| 527 |
| 520 def get_test_names(gtest_tests, swarming_tests): | 528 def get_test_names(gtest_tests, swarming_tests): |
| 521 """Returns the names of each of the tests in |gtest_tests| and | 529 """Returns the names of each of the tests in |gtest_tests| and |
| 522 |swarming_tests|. These are lists of GTestTest and SwarmingGTestTest.""" | 530 |swarming_tests|. These are lists of GTestTest and SwarmingGTestTest.""" |
| 523 return [test.name for test in gtest_tests + swarming_tests] | 531 return [test.name for test in gtest_tests + swarming_tests] |
| 524 | 532 |
| 525 | 533 |
| 526 def filter_tests(possible_tests, needed_tests): | 534 def filter_tests(possible_tests, needed_tests): |
| 527 """Returns a list of all the tests in |possible_tests| whose name is in | 535 """Returns a list of all the tests in |possible_tests| whose name is in |
| 528 |needed_tests|.""" | 536 |needed_tests|.""" |
| 529 result = [] | 537 result = [] |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 all_compile_targets(conditional_tests), | 770 all_compile_targets(conditional_tests), |
| 763 compile_targets=compile_targets, | 771 compile_targets=compile_targets, |
| 764 env=runhooks_env) | 772 env=runhooks_env) |
| 765 if not api.filter.result: | 773 if not api.filter.result: |
| 766 return [], swarming_tests, bot_update_step | 774 return [], swarming_tests, bot_update_step |
| 767 # Patch needs compile. Filter the list of test and compile targets. | 775 # Patch needs compile. Filter the list of test and compile targets. |
| 768 if should_filter_tests(buildername, | 776 if should_filter_tests(buildername, |
| 769 test_spec.get('non_filter_tests_builders', [])): | 777 test_spec.get('non_filter_tests_builders', [])): |
| 770 gtest_tests = filter_tests(gtest_tests, api.filter.matching_exes) | 778 gtest_tests = filter_tests(gtest_tests, api.filter.matching_exes) |
| 771 swarming_tests = filter_tests(swarming_tests, api.filter.matching_exes) | 779 swarming_tests = filter_tests(swarming_tests, api.filter.matching_exes) |
| 772 if buildername in test_spec.get('filter_compile_builders', []): | 780 if should_filter_compile(buildername, |
| 781 test_spec.get('non_filter_compile_builders', |
| 782 [])): |
| 773 if 'all' in compile_targets: | 783 if 'all' in compile_targets: |
| 774 compile_targets = api.filter.compile_targets | 784 compile_targets = api.filter.compile_targets |
| 775 else: | 785 else: |
| 776 compile_targets = list(set(compile_targets) & | 786 compile_targets = list(set(compile_targets) & |
| 777 set(api.filter.compile_targets)) | 787 set(api.filter.compile_targets)) |
| 778 # Always add |matching_exes|. They will be covered by |compile_targets|, | 788 # Always add |matching_exes|. They will be covered by |compile_targets|, |
| 779 # but adding |matching_exes| makes determing if conditional tests are | 789 # but adding |matching_exes| makes determing if conditional tests are |
| 780 # necessary easier. For example, if we didn't do this we could end up | 790 # necessary easier. For example, if we didn't do this we could end up |
| 781 # with chrome_run as a compile_target and not chrome (since chrome_run | 791 # with chrome_run as a compile_target and not chrome (since chrome_run |
| 782 # depends upon chrome). This results in not picking up | 792 # depends upon chrome). This results in not picking up |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1228 ) | 1238 ) |
| 1229 ) | 1239 ) |
| 1230 | 1240 |
| 1231 # Tests analyze module by way of not specifying non_filter_builders and | 1241 # Tests analyze module by way of not specifying non_filter_builders and |
| 1232 # analyze result returning true. This should result in a compile. | 1242 # analyze result returning true. This should result in a compile. |
| 1233 yield ( | 1243 yield ( |
| 1234 api.test('compile_because_of_analyze') + | 1244 api.test('compile_because_of_analyze') + |
| 1235 props(buildername='linux_chromium_rel') + | 1245 props(buildername='linux_chromium_rel') + |
| 1236 api.platform.name('linux') + | 1246 api.platform.name('linux') + |
| 1237 api.override_step_data('read test spec', api.json.output({ | 1247 api.override_step_data('read test spec', api.json.output({ |
| 1248 'non_filter_compile_builders': ['linux_chromium_rel'], |
| 1238 }) | 1249 }) |
| 1239 ) + | 1250 ) + |
| 1240 api.override_step_data( | 1251 api.override_step_data( |
| 1241 'analyze', | 1252 'analyze', |
| 1242 api.json.output({'status': 'Found dependency', 'targets': [], | 1253 api.json.output({'status': 'Found dependency', 'targets': [], |
| 1243 'build_targets': []})) | 1254 'build_targets': []})) |
| 1244 ) | 1255 ) |
| 1245 | 1256 |
| 1246 # Tests analyze module by way of specifying non_filter_builders and | 1257 # Tests analyze module by way of specifying non_filter_builders and |
| 1247 # analyze result returning true along with a smaller set of tests. | 1258 # analyze result returning true along with a smaller set of tests. |
| 1248 yield ( | 1259 yield ( |
| 1249 api.test('compile_because_of_analyze_with_filtered_tests_no_builder') + | 1260 api.test('compile_because_of_analyze_with_filtered_tests_no_builder') + |
| 1250 props(buildername='linux_chromium_rel') + | 1261 props(buildername='linux_chromium_rel') + |
| 1251 api.platform.name('linux') + | 1262 api.platform.name('linux') + |
| 1252 api.override_step_data('read test spec', api.json.output({ | 1263 api.override_step_data('read test spec', api.json.output({ |
| 1253 'non_filter_tests_builders': ['linux_chromium_rel'], | 1264 'non_filter_tests_builders': ['linux_chromium_rel'], |
| 1265 'non_filter_compile_builders': ['linux_chromium_rel'], |
| 1254 'gtest_tests': [ | 1266 'gtest_tests': [ |
| 1255 { | 1267 { |
| 1256 'test': 'base_unittests', | 1268 'test': 'base_unittests', |
| 1257 'swarming': {'can_use_on_swarming_builders': True}, | 1269 'swarming': {'can_use_on_swarming_builders': True}, |
| 1258 }, | 1270 }, |
| 1259 { | 1271 { |
| 1260 'test': 'browser_tests', | 1272 'test': 'browser_tests', |
| 1261 }, | 1273 }, |
| 1262 { | 1274 { |
| 1263 'test': 'unittests', | 1275 'test': 'unittests', |
| 1264 }, | 1276 }, |
| 1265 ], | 1277 ], |
| 1266 }) | 1278 }) |
| 1267 ) + | 1279 ) + |
| 1268 api.override_step_data( | 1280 api.override_step_data( |
| 1269 'analyze', | 1281 'analyze', |
| 1270 api.json.output({'status': 'Found dependency', | 1282 api.json.output({'status': 'Found dependency', |
| 1271 'targets': ['browser_tests', 'base_unittests'], | 1283 'targets': ['browser_tests', 'base_unittests'], |
| 1272 'build_targets': ['browser_tests', 'base_unittests']})) | 1284 'build_targets': ['browser_tests', 'base_unittests']})) |
| 1273 ) | 1285 ) |
| 1274 | 1286 |
| 1275 # Tests analyze module by way of not specifying non_filter_builders and | 1287 # Tests analyze module by way of not specifying non_filter_builders and |
| 1276 # analyze result returning true along with a smaller set of tests. This | 1288 # analyze result returning true along with a smaller set of tests. This |
| 1277 # specifices a 'filter_test_builder', so that this bot uses the filtered set. | 1289 # specifices a 'filter_test_builder', so that this bot uses the filtered set. |
| 1278 yield ( | 1290 yield ( |
| 1279 api.test('compile_because_of_analyze_with_filtered_tests') + | 1291 api.test('compile_because_of_analyze_with_filtered_tests') + |
| 1280 props(buildername='linux_chromium_rel') + | 1292 props(buildername='linux_chromium_rel') + |
| 1281 api.platform.name('linux') + | 1293 api.platform.name('linux') + |
| 1282 api.override_step_data('read test spec', api.json.output({ | 1294 api.override_step_data('read test spec', api.json.output({ |
| 1295 'non_filter_compile_builders': ['linux_chromium_rel'], |
| 1283 'gtest_tests': [ | 1296 'gtest_tests': [ |
| 1284 { | 1297 { |
| 1285 'test': 'base_unittests', | 1298 'test': 'base_unittests', |
| 1286 'swarming': {'can_use_on_swarming_builders': True}, | 1299 'swarming': {'can_use_on_swarming_builders': True}, |
| 1287 }, | 1300 }, |
| 1288 { | 1301 { |
| 1289 'test': 'browser_tests', | 1302 'test': 'browser_tests', |
| 1290 }, | 1303 }, |
| 1291 { | 1304 { |
| 1292 'test': 'unittests', | 1305 'test': 'unittests', |
| 1293 }, | 1306 }, |
| 1294 ], | 1307 ], |
| 1295 }) | 1308 }) |
| 1296 ) + | 1309 ) + |
| 1297 api.override_step_data( | 1310 api.override_step_data( |
| 1298 'analyze', | 1311 'analyze', |
| 1299 api.json.output({'status': 'Found dependency', | 1312 api.json.output({'status': 'Found dependency', |
| 1300 'targets': ['browser_tests', 'base_unittests'], | 1313 'targets': ['browser_tests', 'base_unittests'], |
| 1301 'build_targets': ['browser_tests', 'base_unittests']})) | 1314 'build_targets': ['browser_tests', 'base_unittests']})) |
| 1302 ) | 1315 ) |
| 1303 | 1316 |
| 1304 # Tests compile_target portion of analyze module. | 1317 # Tests compile_target portion of analyze module. |
| 1305 yield ( | 1318 yield ( |
| 1306 api.test('compile_because_of_analyze_with_filtered_compile_targets') + | 1319 api.test('compile_because_of_analyze_with_filtered_compile_targets') + |
| 1307 props(buildername='linux_chromium_rel') + | 1320 props(buildername='linux_chromium_rel') + |
| 1308 api.platform.name('linux') + | 1321 api.platform.name('linux') + |
| 1309 api.override_step_data('read test spec', api.json.output({ | 1322 api.override_step_data('read test spec', api.json.output({ |
| 1310 'filter_compile_builders': 'linux_chromium_rel', | |
| 1311 'gtest_tests': [ | 1323 'gtest_tests': [ |
| 1312 { | 1324 { |
| 1313 'test': 'base_unittests', | 1325 'test': 'base_unittests', |
| 1314 'swarming': {'can_use_on_swarming_builders': True}, | 1326 'swarming': {'can_use_on_swarming_builders': True}, |
| 1315 }, | 1327 }, |
| 1316 { | 1328 { |
| 1317 'test': 'browser_tests', | 1329 'test': 'browser_tests', |
| 1318 }, | 1330 }, |
| 1319 { | 1331 { |
| 1320 'test': 'unittests', | 1332 'test': 'unittests', |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1341 'compile_targets': ['base_unittests'], | 1353 'compile_targets': ['base_unittests'], |
| 1342 'gtest_tests': [ | 1354 'gtest_tests': [ |
| 1343 { | 1355 { |
| 1344 'test': 'browser_tests', | 1356 'test': 'browser_tests', |
| 1345 'args': '--gtest-filter: *NaCl*', | 1357 'args': '--gtest-filter: *NaCl*', |
| 1346 }, { | 1358 }, { |
| 1347 'test': 'base_tests', | 1359 'test': 'base_tests', |
| 1348 'args': ['--gtest-filter: *NaCl*'], | 1360 'args': ['--gtest-filter: *NaCl*'], |
| 1349 }, | 1361 }, |
| 1350 ], | 1362 ], |
| 1351 'filter_compile_builders': 'linux_chromium_browser_asan_rel', | |
| 1352 }) | 1363 }) |
| 1353 ) + | 1364 ) + |
| 1354 api.override_step_data( | 1365 api.override_step_data( |
| 1355 'analyze', | 1366 'analyze', |
| 1356 api.json.output({'status': 'Found dependency', | 1367 api.json.output({'status': 'Found dependency', |
| 1357 'targets': ['browser_tests', 'base_unittests'], | 1368 'targets': ['browser_tests', 'base_unittests'], |
| 1358 'build_targets': ['base_unittests']})) | 1369 'build_targets': ['base_unittests']})) |
| 1359 ) | 1370 ) |
| 1360 | 1371 |
| OLD | NEW |