PRESUBMIT.py (952B)
1 # Copyright 2024 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.util.lib.proto. 5 6 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for 7 details on the presubmit API built into depot_tools. 8 """ 9 10 import os 11 12 13 def CommonChecks(input_api, output_api): 14 build_dir = input_api.PresubmitLocalPath() 15 16 tests = [ 17 input_api.os_path.join(build_dir, f) for f in os.listdir('.') 18 if os.path.isfile(f) and f.endswith('tests.py') 19 ] 20 return input_api.RunTests( 21 input_api.canned_checks.GetUnitTests(input_api, 22 output_api, 23 unit_tests=tests)) 24 25 26 def CheckChangeOnUpload(input_api, output_api): 27 return CommonChecks(input_api, output_api) 28 29 30 def CheckChangeOnCommit(input_api, output_api): 31 return CommonChecks(input_api, output_api)