OLD | NEW |
(Empty) | |
| 1 # Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
| 2 # |
| 3 # Use of this source code is governed by a BSD-style license |
| 4 # that can be found in the LICENSE file in the root of the source |
| 5 # tree. An additional intellectual property rights grant can be found |
| 6 # in the file PATENTS. All contributing project authors may |
| 7 # be found in the AUTHORS file in the root of the source tree. |
| 8 |
| 9 |
| 10 def _CommonChecks(input_api, output_api): |
| 11 results = [] |
| 12 |
| 13 # Run Pylint over the files in the directory. |
| 14 pylint_checks = input_api.canned_checks.GetPylint(input_api, output_api) |
| 15 results.extend(input_api.RunTests(pylint_checks)) |
| 16 |
| 17 # Run the MB unittests. |
| 18 results.extend(input_api.canned_checks.RunUnitTestsInDirectory( |
| 19 input_api, output_api, '.', [ r'^.+_unittest\.py$'])) |
| 20 |
| 21 # Validate the format of the mb_config.pyl file. |
| 22 mb_config_path = input_api.os_path.join(input_api.PresubmitLocalPath(), |
| 23 '..', '..', 'webrtc', 'build', |
| 24 'mb_config.pyl') |
| 25 cmd = [input_api.python_executable, 'mb.py', 'validate', '--config-file', |
| 26 mb_config_path] |
| 27 kwargs = {'cwd': input_api.PresubmitLocalPath()} |
| 28 results.extend(input_api.RunTests([ |
| 29 input_api.Command(name='mb_validate', |
| 30 cmd=cmd, kwargs=kwargs, |
| 31 message=output_api.PresubmitError)])) |
| 32 |
| 33 results.extend( |
| 34 input_api.canned_checks.CheckLongLines( |
| 35 input_api, |
| 36 output_api, |
| 37 maxlen=80, |
| 38 source_file_filter=lambda x: 'mb_config.pyl' in x.LocalPath())) |
| 39 |
| 40 return results |
| 41 |
| 42 |
| 43 def CheckChangeOnUpload(input_api, output_api): |
| 44 return _CommonChecks(input_api, output_api) |
| 45 |
| 46 |
| 47 def CheckChangeOnCommit(input_api, output_api): |
| 48 return _CommonChecks(input_api, output_api) |
OLD | NEW |