Ryan Tseng | 85ec17e | 2018-09-06 17:10:05 -0700 | [diff] [blame] | 1 | # Copyright (c) 2018 The Chromium Authors. All rights reserved. |
| 2 | # Use of this source code is governed by a BSD-style license that can be |
| 3 | # found in the LICENSE file. |
| 4 | |
| 5 | |
btolsch | 333aecd | 2019-04-18 16:21:23 -0700 | [diff] [blame^] | 6 | def _CommonChecks(input_api, output_api): |
| 7 | results = [] |
| 8 | # TODO(issues/43): Probably convert this to python so we can give more |
| 9 | # detailed errors. |
| 10 | presubmit_sh_result = input_api.subprocess.call( |
| 11 | input_api.PresubmitLocalPath() + '/PRESUBMIT.sh') |
| 12 | if presubmit_sh_result != 0: |
| 13 | results.append(output_api.PresubmitError('PRESUBMIT.sh failed')) |
| 14 | return results |
| 15 | |
| 16 | |
Ryan Tseng | 85ec17e | 2018-09-06 17:10:05 -0700 | [diff] [blame] | 17 | def CheckChangeOnUpload(input_api, output_api): |
btolsch | 333aecd | 2019-04-18 16:21:23 -0700 | [diff] [blame^] | 18 | results = [] |
| 19 | results.extend(_CommonChecks(input_api, output_api)) |
| 20 | results.extend( |
| 21 | input_api.canned_checks.CheckChangedLUCIConfigs(input_api, output_api)) |
| 22 | return results |
| 23 | |
| 24 | |
| 25 | def CheckChangeOnCommit(input_api, output_api): |
| 26 | results = [] |
| 27 | results.extend(_CommonChecks(input_api, output_api)) |
| 28 | return results |