1# Copyright 2018 the V8 project 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 5import json 6 7# This line is 'magic' in that git-cl looks for it to decide whether to 8# use Python3 instead of Python2 when running the code in this file. 9USE_PYTHON3 = True 10 11 12def _RunTests(input_api, output_api): 13 return input_api.RunTests( 14 input_api.canned_checks.GetUnitTestsInDirectory( 15 input_api, output_api, '.', files_to_check=[r'.+_test\.py$'])) 16 17 18def _CommonChecks(input_api, output_api): 19 """Checks common to both upload and commit.""" 20 checks = [ 21 _RunTests, 22 ] 23 24 return sum([check(input_api, output_api) for check in checks], []) 25 26def CheckChangeOnCommit(input_api, output_api): 27 return _CommonChecks(input_api, output_api) 28 29def CheckChangeOnUpload(input_api, output_api): 30 return _CommonChecks(input_api, output_api) 31