| 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 1534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1545 | 1545 |
| 1546 | 1546 |
| 1547 def CheckChangeOnUpload(input_api, output_api): | 1547 def CheckChangeOnUpload(input_api, output_api): |
| 1548 results = [] | 1548 results = [] |
| 1549 results.extend(_CommonChecks(input_api, output_api)) | 1549 results.extend(_CommonChecks(input_api, output_api)) |
| 1550 results.extend(_CheckValidHostsInDEPS(input_api, output_api)) | 1550 results.extend(_CheckValidHostsInDEPS(input_api, output_api)) |
| 1551 results.extend(_CheckJavaStyle(input_api, output_api)) | 1551 results.extend(_CheckJavaStyle(input_api, output_api)) |
| 1552 return results | 1552 return results |
| 1553 | 1553 |
| 1554 | 1554 |
| 1555 def GetTryServerMasterForBot(bot): | |
| 1556 """Returns the Try Server master for the given bot. | |
| 1557 | |
| 1558 It tries to guess the master from the bot name, but may still fail | |
| 1559 and return None. There is no longer a default master. | |
| 1560 """ | |
| 1561 # Potentially ambiguous bot names are listed explicitly. | |
| 1562 master_map = { | |
| 1563 'linux_gpu': 'tryserver.chromium.gpu', | |
| 1564 'mac_gpu': 'tryserver.chromium.gpu', | |
| 1565 'win_gpu': 'tryserver.chromium.gpu', | |
| 1566 'chromium_presubmit': 'tryserver.chromium.linux', | |
| 1567 'blink_presubmit': 'tryserver.chromium.linux', | |
| 1568 'tools_build_presubmit': 'tryserver.chromium.linux', | |
| 1569 } | |
| 1570 master = master_map.get(bot) | |
| 1571 if not master: | |
| 1572 if 'gpu' in bot: | |
| 1573 master = 'tryserver.chromium.gpu' | |
| 1574 elif 'linux' in bot or 'android' in bot or 'presubmit' in bot: | |
| 1575 master = 'tryserver.chromium.linux' | |
| 1576 elif 'win' in bot: | |
| 1577 master = 'tryserver.chromium.win' | |
| 1578 elif 'mac' in bot or 'ios' in bot: | |
| 1579 master = 'tryserver.chromium.mac' | |
| 1580 return master | |
| 1581 | |
| 1582 | |
| 1583 def GetDefaultTryConfigs(bots=None): | 1555 def GetDefaultTryConfigs(bots=None): |
| 1584 """Returns a list of ('bot', set(['tests']), optionally filtered by [bots]. | 1556 """Returns a list of ('bot', set(['tests']), optionally filtered by [bots]. |
| 1585 | 1557 |
| 1586 To add tests to this list, they MUST be in the the corresponding master's | |
| 1587 gatekeeper config. For example, anything on master.chromium would be closed by | |
| 1588 tools/build/masters/master.chromium/master_gatekeeper_cfg.py. | |
| 1589 | |
| 1590 If 'bots' is specified, will only return configurations for bots in that list. | 1558 If 'bots' is specified, will only return configurations for bots in that list. |
| 1591 """ | 1559 """ |
| 1592 | 1560 |
| 1593 standard_tests = [ | |
| 1594 'base_unittests', | |
| 1595 'browser_tests', | |
| 1596 'cacheinvalidation_unittests', | |
| 1597 'check_deps', | |
| 1598 'check_deps2git', | |
| 1599 'content_browsertests', | |
| 1600 'content_unittests', | |
| 1601 'crypto_unittests', | |
| 1602 'gpu_unittests', | |
| 1603 'interactive_ui_tests', | |
| 1604 'ipc_tests', | |
| 1605 'jingle_unittests', | |
| 1606 'media_unittests', | |
| 1607 'net_unittests', | |
| 1608 'ppapi_unittests', | |
| 1609 'printing_unittests', | |
| 1610 'sql_unittests', | |
| 1611 'sync_unit_tests', | |
| 1612 'unit_tests', | |
| 1613 # Broken in release. | |
| 1614 #'url_unittests', | |
| 1615 #'webkit_unit_tests', | |
| 1616 ] | |
| 1617 | |
| 1618 builders_and_tests = { | 1561 builders_and_tests = { |
| 1619 # TODO(maruel): Figure out a way to run 'sizes' where people can | 1562 # TODO(maruel): Figure out a way to run 'sizes' where people can |
| 1620 # effectively update the perf expectation correctly. This requires a | 1563 # effectively update the perf expectation correctly. This requires a |
| 1621 # clobber=True build running 'sizes'. 'sizes' is not accurate with | 1564 # clobber=True build running 'sizes'. 'sizes' is not accurate with |
| 1622 # incremental build. Reference: | 1565 # incremental build. Reference: |
| 1623 # http://chromium.org/developers/tree-sheriffs/perf-sheriffs. | 1566 # http://chromium.org/developers/tree-sheriffs/perf-sheriffs. |
| 1624 # TODO(maruel): An option would be to run 'sizes' but not count a failure | 1567 # TODO(maruel): An option would be to run 'sizes' but not count a failure |
| 1625 # of this step as a try job failure. | 1568 # of this step as a try job failure. |
| 1626 'android_aosp': ['compile'], | 1569 'Mojo Linux Try': ['defaulttests'], |
| 1627 'android_arm64_dbg_recipe': ['slave_steps'], | |
| 1628 'android_chromium_gn_compile_dbg': ['compile'], | |
| 1629 'android_chromium_gn_compile_rel': ['compile'], | |
| 1630 'android_clang_dbg': ['slave_steps'], | |
| 1631 'android_clang_dbg_recipe': ['slave_steps'], | |
| 1632 'android_dbg_tests_recipe': ['slave_steps'], | |
| 1633 'cros_x86': ['defaulttests'], | |
| 1634 'ios_dbg_simulator': [ | |
| 1635 'compile', | |
| 1636 'base_unittests', | |
| 1637 'content_unittests', | |
| 1638 'crypto_unittests', | |
| 1639 'url_unittests', | |
| 1640 'net_unittests', | |
| 1641 'sql_unittests', | |
| 1642 'ui_base_unittests', | |
| 1643 'ui_unittests', | |
| 1644 ], | |
| 1645 'ios_rel_device': ['compile'], | |
| 1646 'ios_rel_device_ninja': ['compile'], | |
| 1647 'mac_asan': ['compile'], | |
| 1648 #TODO(stip): Change the name of this builder to reflect that it's release. | |
| 1649 'linux_gtk': standard_tests, | |
| 1650 'linux_chromeos_asan': ['compile'], | |
| 1651 'linux_chromium_chromeos_clang_dbg': ['defaulttests'], | |
| 1652 'linux_chromium_chromeos_rel_swarming': ['defaulttests'], | |
| 1653 'linux_chromium_compile_dbg': ['defaulttests'], | |
| 1654 'linux_chromium_gn_dbg': ['compile'], | |
| 1655 'linux_chromium_gn_rel': ['defaulttests'], | |
| 1656 'linux_chromium_rel_swarming': ['defaulttests'], | |
| 1657 'linux_chromium_clang_dbg': ['defaulttests'], | |
| 1658 'linux_gpu': ['defaulttests'], | |
| 1659 'linux_nacl_sdk_build': ['compile'], | |
| 1660 'mac_chromium_compile_dbg': ['defaulttests'], | |
| 1661 'mac_chromium_rel_swarming': ['defaulttests'], | |
| 1662 'mac_gpu': ['defaulttests'], | |
| 1663 'mac_nacl_sdk_build': ['compile'], | |
| 1664 'win_chromium_compile_dbg': ['defaulttests'], | |
| 1665 'win_chromium_dbg': ['defaulttests'], | |
| 1666 'win_chromium_rel_swarming': ['defaulttests'], | |
| 1667 'win_chromium_x64_rel_swarming': ['defaulttests'], | |
| 1668 'win_gpu': ['defaulttests'], | |
| 1669 'win_nacl_sdk_build': ['compile'], | |
| 1670 'win8_chromium_rel': ['defaulttests'], | |
| 1671 } | 1570 } |
| 1672 | 1571 |
| 1673 if bots: | 1572 if bots: |
| 1674 filtered_builders_and_tests = dict((bot, set(builders_and_tests[bot])) | 1573 filtered_builders_and_tests = dict((bot, set(builders_and_tests[bot])) |
| 1675 for bot in bots) | 1574 for bot in bots) |
| 1676 else: | 1575 else: |
| 1677 filtered_builders_and_tests = dict( | 1576 filtered_builders_and_tests = dict( |
| 1678 (bot, set(tests)) | 1577 (bot, set(tests)) |
| 1679 for bot, tests in builders_and_tests.iteritems()) | 1578 for bot, tests in builders_and_tests.iteritems()) |
| 1680 | 1579 |
| 1681 # Build up the mapping from tryserver master to bot/test. | 1580 # Build up the mapping from tryserver master to bot/test. |
| 1682 out = dict() | 1581 out = dict() |
| 1683 for bot, tests in filtered_builders_and_tests.iteritems(): | 1582 for bot, tests in filtered_builders_and_tests.iteritems(): |
| 1684 out.setdefault(GetTryServerMasterForBot(bot), {})[bot] = tests | 1583 out.setdefault("tryserver.client.mojo", {})[bot] = tests |
| 1685 return out | 1584 return out |
| 1686 | 1585 |
| 1687 | 1586 |
| 1688 def CheckChangeOnCommit(input_api, output_api): | 1587 def CheckChangeOnCommit(input_api, output_api): |
| 1689 results = [] | 1588 results = [] |
| 1690 results.extend(_CommonChecks(input_api, output_api)) | 1589 results.extend(_CommonChecks(input_api, output_api)) |
| 1691 results.extend(input_api.canned_checks.CheckChangeHasBugField( | 1590 results.extend(input_api.canned_checks.CheckChangeHasBugField( |
| 1692 input_api, output_api)) | 1591 input_api, output_api)) |
| 1693 results.extend(input_api.canned_checks.CheckChangeHasDescription( | 1592 results.extend(input_api.canned_checks.CheckChangeHasDescription( |
| 1694 input_api, output_api)) | 1593 input_api, output_api)) |
| 1695 return results | 1594 return results |
| 1696 | 1595 |
| 1697 | 1596 |
| 1698 def GetPreferredTryMasters(project, change): | 1597 def GetPreferredTryMasters(project, change): |
| 1699 import re | 1598 import re |
| 1700 files = change.LocalPaths() | 1599 files = change.LocalPaths() |
| 1701 | 1600 |
| 1702 if not files or all(re.search(r'[\\\/]OWNERS$', f) for f in files): | 1601 if not files or all(re.search(r'[\\\/]OWNERS$', f) for f in files): |
| 1703 return {} | 1602 return {} |
| 1704 | 1603 |
| 1705 if all(re.search(r'\.(m|mm)$|(^|[\\\/_])mac[\\\/_.]', f) for f in files): | |
| 1706 return GetDefaultTryConfigs([ | |
| 1707 'mac_chromium_compile_dbg', | |
| 1708 'mac_chromium_rel_swarming', | |
| 1709 ]) | |
| 1710 if all(re.search('(^|[/_])win[/_.]', f) for f in files): | |
| 1711 return GetDefaultTryConfigs([ | |
| 1712 'win_chromium_dbg', | |
| 1713 'win_chromium_rel_swarming', | |
| 1714 'win8_chromium_rel', | |
| 1715 ]) | |
| 1716 if all(re.search(r'(^|[\\\/_])android[\\\/_.]', f) for f in files): | |
| 1717 return GetDefaultTryConfigs([ | |
| 1718 'android_aosp', | |
| 1719 'android_clang_dbg', | |
| 1720 'android_dbg_tests_recipe', | |
| 1721 ]) | |
| 1722 if all(re.search(r'[\\\/_]ios[\\\/_.]', f) for f in files): | |
| 1723 return GetDefaultTryConfigs(['ios_rel_device', 'ios_dbg_simulator']) | |
| 1724 | |
| 1725 builders = [ | 1604 builders = [ |
| 1726 'android_arm64_dbg_recipe', | 1605 'Mojo Linux Try', |
| 1727 'android_chromium_gn_compile_rel', | |
| 1728 'android_chromium_gn_compile_dbg', | |
| 1729 'android_clang_dbg', | |
| 1730 'android_clang_dbg_recipe', | |
| 1731 'android_dbg_tests_recipe', | |
| 1732 'ios_dbg_simulator', | |
| 1733 'ios_rel_device', | |
| 1734 'ios_rel_device_ninja', | |
| 1735 'linux_chromium_chromeos_rel_swarming', | |
| 1736 'linux_chromium_clang_dbg', | |
| 1737 'linux_chromium_gn_dbg', | |
| 1738 'linux_chromium_gn_rel', | |
| 1739 'linux_chromium_rel_swarming', | |
| 1740 'linux_gpu', | |
| 1741 'mac_chromium_compile_dbg', | |
| 1742 'mac_chromium_rel_swarming', | |
| 1743 'mac_gpu', | |
| 1744 'win_chromium_compile_dbg', | |
| 1745 'win_chromium_rel_swarming', | |
| 1746 'win_chromium_x64_rel_swarming', | |
| 1747 'win_gpu', | |
| 1748 'win8_chromium_rel', | |
| 1749 ] | 1606 ] |
| 1750 | 1607 |
| 1751 # Match things like path/aura/file.cc and path/file_aura.cc. | |
| 1752 # Same for chromeos. | |
| 1753 if any(re.search(r'[\\\/_](aura|chromeos)', f) for f in files): | |
| 1754 builders.extend([ | |
| 1755 'linux_chromeos_asan', | |
| 1756 'linux_chromium_chromeos_clang_dbg' | |
| 1757 ]) | |
| 1758 | |
| 1759 # If there are gyp changes to base, build, or chromeos, run a full cros build | |
| 1760 # in addition to the shorter linux_chromeos build. Changes to high level gyp | |
| 1761 # files have a much higher chance of breaking the cros build, which is | |
| 1762 # differnt from the linux_chromeos build that most chrome developers test | |
| 1763 # with. | |
| 1764 if any(re.search('^(base|build|chromeos).*\.gypi?$', f) for f in files): | |
| 1765 builders.extend(['cros_x86']) | |
| 1766 | |
| 1767 # The AOSP bot doesn't build the chrome/ layer, so ignore any changes to it | |
| 1768 # unless they're .gyp(i) files as changes to those files can break the gyp | |
| 1769 # step on that bot. | |
| 1770 if (not all(re.search('^chrome', f) for f in files) or | |
| 1771 any(re.search('\.gypi?$', f) for f in files)): | |
| 1772 builders.extend(['android_aosp']) | |
| 1773 | |
| 1774 return GetDefaultTryConfigs(builders) | 1608 return GetDefaultTryConfigs(builders) |
| OLD | NEW |