1# Copyright 2022 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"""Top-level presubmit script for build/fuchsia/test. 5 6See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts 7for more details about the presubmit API built into depot_tools. 8""" 9 10USE_PYTHON3 = True 11 12_EXTRA_PATHS_COMPONENTS = [('testing', )] 13 14# pylint: disable=invalid-name,missing-function-docstring 15def CommonChecks(input_api, output_api): 16 # Neither running nor linting Fuchsia tests is supported on Windows. 17 if input_api.is_windows: 18 return [] 19 20 tests = [] 21 22 chromium_src_path = input_api.os_path.realpath( 23 input_api.os_path.join(input_api.PresubmitLocalPath(), '..', '..', 24 '..')) 25 pylint_extra_paths = [ 26 input_api.os_path.join(chromium_src_path, *component) 27 for component in _EXTRA_PATHS_COMPONENTS 28 ] 29 tests.extend( 30 input_api.canned_checks.GetPylint(input_api, 31 output_api, 32 extra_paths_list=pylint_extra_paths, 33 pylintrc='pylintrc', 34 version='2.7')) 35 36 # coveragetest.py is responsible for running unit tests in this directory 37 tests.append( 38 input_api.Command( 39 name='coveragetest', 40 cmd=[input_api.python3_executable, 'coveragetest.py'], 41 kwargs={}, 42 message=output_api.PresubmitError)) 43 return input_api.RunTests(tests) 44 45 46def CheckChangeOnUpload(input_api, output_api): 47 return CommonChecks(input_api, output_api) 48 49 50def CheckChangeOnCommit(input_api, output_api): 51 return CommonChecks(input_api, output_api) 52