blob: d04a511fea7fa498ed84582ea35b86f738a6dec3 [file] [log] [blame]
[email protected]e615e9c2012-03-07 21:39:001# Copyright (c) 2012 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
5"""Top-level presubmit script for testing.
6
tfarina78bb92f42015-01-31 00:20:487See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
8for more details on the presubmit API built into depot_tools.
[email protected]e615e9c2012-03-07 21:39:009"""
10
Josip Sokcevic3d5cd732021-06-14 17:59:5711USE_PYTHON3 = True
12
[email protected]e615e9c2012-03-07 21:39:0013
14def CommonChecks(input_api, output_api):
Brian Sheedy75fc5152021-06-28 20:07:1315 testing_env = dict(input_api.environ)
16 # TODO(crbug.com/1222826): Remove this path addition once all GPU-specific
17 # code is pulled out of the common code.
18 gpu_path = input_api.os_path.join(
19 input_api.PresubmitLocalPath(), '..', 'content', 'test', 'gpu')
20 testing_env.update({
Kyle Farnung24859c42021-07-08 23:02:3521 'PYTHONPATH': input_api.os_path.pathsep.join(
22 [input_api.PresubmitLocalPath(), gpu_path]),
Brian Sheedy75fc5152021-06-28 20:07:1323 'PYTHONDONTWRITEBYTECODE': '1',
24 })
25
[email protected]e615e9c2012-03-07 21:39:0026 output = []
Ilia Samsonova00835302019-04-19 17:37:5927 output.extend(input_api.canned_checks.RunUnitTestsInDirectory(
28 input_api, output_api, '.', [r'^.+_unittest\.py$']))
Brian Sheedy75fc5152021-06-28 20:07:1329 output.extend(input_api.canned_checks.RunUnitTestsInDirectory(
30 input_api,
31 output_api,
32 input_api.os_path.join(input_api.PresubmitLocalPath(),
33 'unexpected_passes_common'),
34 [r'^.+_unittest\.py$'],
35 env=testing_env))
[email protected]e615e9c2012-03-07 21:39:0036 output.extend(input_api.canned_checks.RunPylint(
Ben Pastene4b514ab2020-09-16 01:07:1337 input_api, output_api, files_to_skip=[r'gmock.*', r'gtest.*']))
[email protected]e615e9c2012-03-07 21:39:0038 return output
39
40
41def CheckChangeOnUpload(input_api, output_api):
42 return CommonChecks(input_api, output_api)
43
44
45def CheckChangeOnCommit(input_api, output_api):
46 return CommonChecks(input_api, output_api)