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 depot_tools. | 8 for more details about the presubmit API built into depot_tools. |
9 """ | 9 """ |
10 | 10 |
(...skipping 1696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1707 input_api, output_api)) | 1707 input_api, output_api)) |
1708 results.extend(input_api.canned_checks.CheckChangeHasDescription( | 1708 results.extend(input_api.canned_checks.CheckChangeHasDescription( |
1709 input_api, output_api)) | 1709 input_api, output_api)) |
1710 return results | 1710 return results |
1711 | 1711 |
1712 | 1712 |
1713 def GetPreferredTryMasters(project, change): | 1713 def GetPreferredTryMasters(project, change): |
1714 import re | 1714 import re |
1715 files = change.LocalPaths() | 1715 files = change.LocalPaths() |
1716 | 1716 |
1717 if not files or all(re.search(r'[\\\/]OWNERS$', f) for f in files): | |
1718 return {} | |
1719 | |
1720 if all(re.search(r'\.(m|mm)$|(^|[\\\/_])mac[\\\/_.]', f) for f in files): | |
1721 return GetDefaultTryConfigs([ | |
1722 'mac_chromium_compile_dbg_ng', | |
1723 'mac_chromium_rel_ng', | |
1724 ]) | |
1725 if all(re.search('(^|[/_])win[/_.]', f) for f in files): | |
1726 return GetDefaultTryConfigs([ | |
1727 'win8_chromium_rel', | |
1728 'win_chromium_rel_ng', | |
1729 'win_chromium_x64_rel_ng', | |
1730 ]) | |
1731 if all(re.search(r'(^|[\\\/_])android[\\\/_.]', f) and | |
1732 not re.search(r'(^|[\\\/_])devtools[\\\/_.]', f) for f in files): | |
1733 return GetDefaultTryConfigs([ | |
1734 'android_aosp', | |
1735 'android_rel_tests_recipe', | |
1736 ]) | |
1737 if all(re.search(r'[\\\/_]ios[\\\/_.]', f) for f in files): | |
1738 return GetDefaultTryConfigs(['ios_rel_device', 'ios_dbg_simulator']) | |
1739 | |
1740 import os | 1717 import os |
1741 import json | 1718 import json |
1742 with open(os.path.join( | 1719 with open(os.path.join( |
1743 change.RepositoryRoot(), 'testing', 'commit_queue', 'config.json')) as f: | 1720 change.RepositoryRoot(), 'testing', 'commit_queue', 'config.json')) as f: |
1744 cq_config = json.load(f) | 1721 cq_config = json.load(f) |
1745 cq_trybots = cq_config.get('trybots', {}) | 1722 cq_trybots = cq_config.get('trybots', {}) |
1746 builders = cq_trybots.get('launched', {}) | 1723 builders = cq_trybots.get('launched', {}) |
1747 for master, master_config in cq_trybots.get('triggered', {}).iteritems(): | 1724 for master, master_config in cq_trybots.get('triggered', {}).iteritems(): |
1748 for triggered_bot in master_config: | 1725 for triggered_bot in master_config: |
1749 builders.get(master, {}).pop(triggered_bot, None) | 1726 builders.get(master, {}).pop(triggered_bot, None) |
1750 | 1727 |
1751 # Explicitly iterate over copies of dicts since we mutate them. | 1728 # Explicitly iterate over copies of dicts since we mutate them. |
1752 for master in builders.keys(): | 1729 for master in builders.keys(): |
1753 for builder in builders[master].keys(): | 1730 for builder in builders[master].keys(): |
1754 # Do not trigger presubmit builders, since they're likely to fail | 1731 # Do not trigger presubmit builders, since they're likely to fail |
1755 # (e.g. OWNERS checks before finished code review), and we're | 1732 # (e.g. OWNERS checks before finished code review), and we're |
1756 # running local presubmit anyway. | 1733 # running local presubmit anyway. |
1757 if 'presubmit' in builder: | 1734 if 'presubmit' in builder: |
1758 builders[master].pop(builder) | 1735 builders[master].pop(builder) |
1759 | 1736 |
1760 # Match things like path/aura/file.cc and path/file_aura.cc. | |
1761 # Same for chromeos. | |
1762 if any(re.search(r'[\\\/_](aura|chromeos)', f) for f in files): | |
1763 tryserver_linux = builders.setdefault('tryserver.chromium.linux', {}) | |
1764 tryserver_linux['linux_chromium_chromeos_asan_rel_ng'] = ['defaulttests'] | |
1765 | |
1766 return builders | 1737 return builders |
OLD | NEW |