1# Copyright (c) 2013 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"""Presubmit script for android buildbot. 6 7See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for 8details on the presubmit API built into depot_tools. 9""" 10 11 12def CommonChecks(input_api, output_api): 13 output = [] 14 15 build_android_dir = input_api.PresubmitLocalPath() 16 17 def J(*dirs): 18 """Returns a path relative to presubmit directory.""" 19 return input_api.os_path.join(build_android_dir, *dirs) 20 21 build_pys = [ 22 r'gyp/.*\.py$', 23 r'gn/.*\.py', 24 r'incremental_install/.*\.py', 25 ] 26 output.extend(input_api.canned_checks.RunPylint( 27 input_api, 28 output_api, 29 pylintrc='pylintrc', 30 black_list=build_pys, 31 extra_paths_list=[ 32 J(), 33 J('buildbot'), 34 J('..', '..', 'third_party', 'catapult', 'devil') 35 ])) 36 output.extend(input_api.canned_checks.RunPylint( 37 input_api, 38 output_api, 39 white_list=build_pys, 40 extra_paths_list=[J('gyp'), J('gn')])) 41 42 # Disabled due to http://crbug.com/410936 43 #output.extend(input_api.canned_checks.RunUnitTestsInDirectory( 44 #input_api, output_api, J('buildbot', 'tests'))) 45 46 pylib_test_env = dict(input_api.environ) 47 pylib_test_env.update({ 48 'PYTHONPATH': build_android_dir, 49 'PYTHONDONTWRITEBYTECODE': '1', 50 }) 51 output.extend(input_api.canned_checks.RunUnitTests( 52 input_api, 53 output_api, 54 unit_tests=[ 55 J('.', 'emma_coverage_stats_test.py'), 56 J('gyp', 'util', 'md5_check_test.py'), 57 J('play_services', 'update_test.py'), 58 J('pylib', 'base', 'test_dispatcher_unittest.py'), 59 J('pylib', 'gtest', 'gtest_test_instance_test.py'), 60 J('pylib', 'instrumentation', 61 'instrumentation_test_instance_test.py'), 62 J('pylib', 'results', 'json_results_test.py'), 63 J('pylib', 'symbols', 'elf_symbolizer_unittest.py'), 64 ], 65 env=pylib_test_env)) 66 67 return output 68 69 70def CheckChangeOnUpload(input_api, output_api): 71 return CommonChecks(input_api, output_api) 72 73 74def CheckChangeOnCommit(input_api, output_api): 75 return CommonChecks(input_api, output_api) 76