You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.5 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  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. def _CommonChecks(input_api, output_api):
  9. results = []
  10. # Run Pylint over the files in the directory.
  11. pylint_checks = input_api.canned_checks.GetPylint(input_api, output_api)
  12. results.extend(input_api.RunTests(pylint_checks))
  13. # Run the MB unittests.
  14. results.extend(input_api.canned_checks.RunUnitTestsInDirectory(
  15. input_api, output_api, '.', [ r'^.+_unittest\.py$']))
  16. # Validate the format of the mb_config.pyl file.
  17. cmd = [input_api.python_executable, 'mb.py', 'validate']
  18. kwargs = {'cwd': input_api.PresubmitLocalPath()}
  19. results.extend(input_api.RunTests([
  20. input_api.Command(name='mb_validate',
  21. cmd=cmd, kwargs=kwargs,
  22. message=output_api.PresubmitError)]))
  23. results.extend(
  24. input_api.canned_checks.CheckLongLines(
  25. input_api,
  26. output_api,
  27. maxlen=80,
  28. source_file_filter=lambda x: 'mb_config.pyl' in x.LocalPath()))
  29. return results
  30. def CheckChangeOnUpload(input_api, output_api):
  31. return _CommonChecks(input_api, output_api)
  32. def CheckChangeOnCommit(input_api, output_api):
  33. return _CommonChecks(input_api, output_api)