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 10 11_EXTRA_PATHS_COMPONENTS = [('testing', )] 12 13# pylint: disable=invalid-name,missing-function-docstring 14def CommonChecks(input_api, output_api): 15 # Neither running nor linting Fuchsia tests is supported on Windows. 16 if input_api.is_windows: 17 return [] 18 19 tests = [] 20 21 chromium_src_path = input_api.os_path.realpath( 22 input_api.os_path.join(input_api.PresubmitLocalPath(), '..', '..', 23 '..')) 24 pylint_extra_paths = [ 25 input_api.os_path.join(chromium_src_path, *component) 26 for component in _EXTRA_PATHS_COMPONENTS 27 ] 28 tests.extend( 29 input_api.canned_checks.GetPylint(input_api, 30 output_api, 31 extra_paths_list=pylint_extra_paths, 32 pylintrc='pylintrc', 33 version='2.7')) 34 35 # coveragetest.py is responsible for running unit tests in this directory 36 tests.append( 37 input_api.Command( 38 name='coveragetest', 39 cmd=[input_api.python3_executable, 'coveragetest.py'], 40 kwargs={}, 41 message=output_api.PresubmitError)) 42 return input_api.RunTests(tests) 43 44 45def CheckChangeOnUpload(input_api, output_api): 46 return CommonChecks(input_api, output_api) 47 48 49def CheckChangeOnCommit(input_api, output_api): 50 return CommonChecks(input_api, output_api) 51