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 1770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1781 json_url='http://chromium-status.appspot.com/current?format=json')) | 1781 json_url='http://chromium-status.appspot.com/current?format=json')) |
1782 | 1782 |
1783 results.extend(input_api.canned_checks.CheckChangeHasBugField( | 1783 results.extend(input_api.canned_checks.CheckChangeHasBugField( |
1784 input_api, output_api)) | 1784 input_api, output_api)) |
1785 results.extend(input_api.canned_checks.CheckChangeHasDescription( | 1785 results.extend(input_api.canned_checks.CheckChangeHasDescription( |
1786 input_api, output_api)) | 1786 input_api, output_api)) |
1787 return results | 1787 return results |
1788 | 1788 |
1789 | 1789 |
1790 def GetPreferredTryMasters(project, change): | 1790 def GetPreferredTryMasters(project, change): |
| 1791 import re |
| 1792 files = change.LocalPaths() |
| 1793 |
| 1794 import os |
1791 import json | 1795 import json |
1792 import os.path | 1796 with open(os.path.join( |
1793 import platform | 1797 change.RepositoryRoot(), 'testing', 'commit_queue', 'config.json')) as f: |
1794 import subprocess | 1798 cq_config = json.load(f) |
| 1799 cq_verifiers = cq_config.get('verifiers_no_patch', {}) |
| 1800 cq_try_jobs = cq_verifiers.get('try_job_verifier', {}) |
| 1801 builders = cq_try_jobs.get('launched', {}) |
1795 | 1802 |
1796 cq_config_path = os.path.join( | 1803 for master, master_config in cq_try_jobs.get('triggered', {}).iteritems(): |
1797 change.RepositoryRoot(), 'infra', 'config', 'cq.cfg') | 1804 for triggered_bot in master_config: |
1798 # commit_queue.py below is a script in depot_tools directory, which has a | 1805 builders.get(master, {}).pop(triggered_bot, None) |
1799 # 'builders' command to retrieve a list of CQ builders from the CQ config. | |
1800 is_win = platform.system() == 'Windows' | |
1801 masters = json.loads(subprocess.check_output( | |
1802 ['commit_queue', 'builders', cq_config_path], shell=is_win)) | |
1803 | 1806 |
1804 # Explicitly iterate over copies of keys since we mutate them. | 1807 # Explicitly iterate over copies of dicts since we mutate them. |
1805 for master in masters.keys(): | 1808 for master in builders.keys(): |
1806 for builder in masters[master].keys(): | 1809 for builder in builders[master].keys(): |
1807 # Do not trigger presubmit builders, since they're likely to fail | 1810 # Do not trigger presubmit builders, since they're likely to fail |
1808 # (e.g. OWNERS checks before finished code review), and we're | 1811 # (e.g. OWNERS checks before finished code review), and we're |
1809 # running local presubmit anyway. | 1812 # running local presubmit anyway. |
1810 if 'presubmit' in builder: | 1813 if 'presubmit' in builder: |
1811 masters[master].pop(builder) | 1814 builders[master].pop(builder) |
1812 else: | |
1813 # Convert testfilter format to the one expected by git-cl-try. | |
1814 testfilter = masters[master][builder].get('testfilter', 'defaulttests') | |
1815 masters[master][builder] = [testfilter] | |
1816 | 1815 |
1817 return masters | 1816 return builders |
OLD | NEW |