OLD | NEW |
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Presubmit script for android buildbot. | 5 """Presubmit script for android buildbot. |
6 | 6 |
7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for | 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for |
8 details on the presubmit API built into depot_tools. | 8 details on the presubmit API built into depot_tools. |
9 """ | 9 """ |
10 | 10 |
11 | 11 |
12 def CommonChecks(input_api, output_api): | 12 def CommonChecks(input_api, output_api): |
13 output = [] | 13 output = [] |
14 | 14 |
15 build_android_dir = input_api.PresubmitLocalPath() | |
16 chromium_src_dir = input_api.os_path.join(build_android_dir, '..', '..') | |
17 | |
18 def J(*dirs): | 15 def J(*dirs): |
19 """Returns a path relative to presubmit directory.""" | 16 """Returns a path relative to presubmit directory.""" |
20 return input_api.os_path.join(build_android_dir, *dirs) | 17 return input_api.os_path.join(input_api.PresubmitLocalPath(), *dirs) |
21 | 18 |
22 build_pys = [ | 19 build_pys = [ |
23 r'gyp/.*\.py$', | 20 r'gyp/.*\.py$', |
24 r'gn/.*\.py', | 21 r'gn/.*\.py', |
25 r'incremental_install/.*\.py', | 22 r'incremental_install/.*\.py', |
26 ] | 23 ] |
27 output.extend(input_api.canned_checks.RunPylint( | 24 output.extend(input_api.canned_checks.RunPylint( |
28 input_api, | 25 input_api, |
29 output_api, | 26 output_api, |
30 pylintrc='pylintrc', | 27 pylintrc='pylintrc', |
31 # symbols has its own PRESUBMIT.py | 28 # symbols has its own PRESUBMIT.py |
32 black_list=build_pys + [r'pylib/symbols/.*\.py$'], | 29 black_list=build_pys + [r'pylib/symbols/.*\.py$'], |
33 extra_paths_list=[J(), J('buildbot')])) | 30 extra_paths_list=[J(), J('buildbot')])) |
34 output.extend(input_api.canned_checks.RunPylint( | 31 output.extend(input_api.canned_checks.RunPylint( |
35 input_api, | 32 input_api, |
36 output_api, | 33 output_api, |
37 white_list=build_pys, | 34 white_list=build_pys, |
38 extra_paths_list=[J('gyp'), J('gn')])) | 35 extra_paths_list=[J('gyp'), J('gn')])) |
39 | 36 |
40 # Disabled due to http://crbug.com/410936 | 37 # Disabled due to http://crbug.com/410936 |
41 #output.extend(input_api.canned_checks.RunUnitTestsInDirectory( | 38 #output.extend(input_api.canned_checks.RunUnitTestsInDirectory( |
42 #input_api, output_api, J('buildbot', 'tests'))) | 39 #input_api, output_api, J('buildbot', 'tests'))) |
43 | 40 |
44 pylib_test_env = dict(input_api.environ) | 41 pylib_test_env = dict(input_api.environ) |
45 pylib_test_env.update({ | 42 pylib_test_env.update({ |
46 'PYTHONPATH': build_android_dir, | 43 'PYTHONPATH': input_api.PresubmitLocalPath(), |
47 'PYTHONDONTWRITEBYTECODE': '1', | 44 'PYTHONDONTWRITEBYTECODE': '1', |
48 }) | 45 }) |
49 output.extend(input_api.canned_checks.RunUnitTests( | 46 output.extend(input_api.canned_checks.RunUnitTests( |
50 input_api, | 47 input_api, |
51 output_api, | 48 output_api, |
52 unit_tests=[ | 49 unit_tests=[ |
53 J('.', 'emma_coverage_stats_test.py'), | 50 J('.', 'emma_coverage_stats_test.py'), |
| 51 J('devil', 'android', 'battery_utils_test.py'), |
| 52 J('devil', 'android', 'device_utils_test.py'), |
| 53 J('devil', 'android', 'md5sum_test.py'), |
| 54 J('devil', 'android', 'logcat_monitor_test.py'), |
| 55 J('devil', 'utils', 'cmd_helper_test.py'), |
| 56 J('devil', 'utils', 'timeout_retry_unittest.py'), |
54 J('gyp', 'util', 'md5_check_test.py'), | 57 J('gyp', 'util', 'md5_check_test.py'), |
55 J('pylib', 'base', 'test_dispatcher_unittest.py'), | 58 J('pylib', 'base', 'test_dispatcher_unittest.py'), |
56 J('pylib', 'gtest', 'gtest_test_instance_test.py'), | 59 J('pylib', 'gtest', 'gtest_test_instance_test.py'), |
57 J('pylib', 'instrumentation', | 60 J('pylib', 'instrumentation', |
58 'instrumentation_test_instance_test.py'), | 61 'instrumentation_test_instance_test.py'), |
59 J('pylib', 'results', 'json_results_test.py'), | 62 J('pylib', 'results', 'json_results_test.py'), |
60 ], | 63 ], |
61 env=pylib_test_env)) | 64 env=pylib_test_env)) |
62 | |
63 | |
64 devil_test_env = dict(pylib_test_env) | |
65 devil_test_env.update({ | |
66 'DEVIL_ENV_CONFIG': | |
67 input_api.os_path.join(chromium_src_dir, 'build', 'android', | |
68 'devil_chromium.json') | |
69 }) | |
70 output.extend(input_api.canned_checks.RunUnitTests( | |
71 input_api, | |
72 output_api, | |
73 unit_tests=[ | |
74 J('devil', 'android', 'battery_utils_test.py'), | |
75 J('devil', 'android', 'device_utils_test.py'), | |
76 J('devil', 'android', 'md5sum_test.py'), | |
77 J('devil', 'android', 'logcat_monitor_test.py'), | |
78 J('devil', 'utils', 'cmd_helper_test.py'), | |
79 J('devil', 'utils', 'timeout_retry_unittest.py'), | |
80 ], | |
81 env=devil_test_env)) | |
82 return output | 65 return output |
83 | 66 |
84 | 67 |
85 def CheckChangeOnUpload(input_api, output_api): | 68 def CheckChangeOnUpload(input_api, output_api): |
86 return CommonChecks(input_api, output_api) | 69 return CommonChecks(input_api, output_api) |
87 | 70 |
88 | 71 |
89 def CheckChangeOnCommit(input_api, output_api): | 72 def CheckChangeOnCommit(input_api, output_api): |
90 return CommonChecks(input_api, output_api) | 73 return CommonChecks(input_api, output_api) |
OLD | NEW |