xref: /aosp_15_r20/external/cronet/build/chromeos/PRESUBMIT.py (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1# Copyright 2013 The Chromium Authors
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 build/chromeos/.
5
6See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for
7details on the presubmit API built into depot_tools.
8"""
9
10
11
12
13def CommonChecks(input_api, output_api):
14  results = []
15  # These tests don't run on Windows and give verbose and cryptic failure
16  # messages. Linting the code on a platform where it will not run is also not
17  # valuable and gives spurious errors.
18  if input_api.sys.platform != 'win32':
19    results += input_api.canned_checks.RunPylint(
20        input_api, output_api, pylintrc='pylintrc', version='2.6')
21    tests = input_api.canned_checks.GetUnitTestsInDirectory(
22        input_api, output_api, '.', [r'^.+_test\.py$'])
23    results += input_api.RunTests(tests)
24  return results
25
26
27def CheckChangeOnUpload(input_api, output_api):
28  return CommonChecks(input_api, output_api)
29
30
31def CheckChangeOnCommit(input_api, output_api):
32  return CommonChecks(input_api, output_api)
33