PRESUBMIT.py 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # Copyright 2021 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. """Presubmit script for Fuchsia.
  5. See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for
  6. details on the presubmit API built into depot_tools.
  7. """
  8. USE_PYTHON3 = True
  9. import os
  10. def CommonChecks(input_api, output_api):
  11. build_fuchsia_dir = input_api.PresubmitLocalPath()
  12. def J(*dirs):
  13. """Returns a path relative to presubmit directory."""
  14. return input_api.os_path.join(build_fuchsia_dir, *dirs)
  15. tests = []
  16. unit_tests = [
  17. J('binary_sizes_test.py'),
  18. J('binary_size_differ_test.py'),
  19. J('device_target_test.py'),
  20. J('ermine_ctl_test.py'),
  21. ]
  22. # TODO(1309977): enable on Windows when fixed.
  23. if os.name != 'nt':
  24. unit_tests.extend([J('fvdl_target_test.py')])
  25. tests.extend(
  26. input_api.canned_checks.GetUnitTests(input_api,
  27. output_api,
  28. unit_tests=unit_tests,
  29. run_on_python2=False,
  30. run_on_python3=True,
  31. skip_shebang_check=True))
  32. return input_api.RunTests(tests)
  33. def CheckChangeOnUpload(input_api, output_api):
  34. return CommonChecks(input_api, output_api)
  35. def CheckChangeOnCommit(input_api, output_api):
  36. return CommonChecks(input_api, output_api)