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 |
15 def J(*dirs): | 18 def J(*dirs): |
16 """Returns a path relative to presubmit directory.""" | 19 """Returns a path relative to presubmit directory.""" |
17 return input_api.os_path.join(input_api.PresubmitLocalPath(), *dirs) | 20 return input_api.os_path.join(build_android_dir, *dirs) |
18 | 21 |
19 build_pys = [ | 22 build_pys = [ |
20 r'gyp/.*\.py$', | 23 r'gyp/.*\.py$', |
21 r'gn/.*\.py', | 24 r'gn/.*\.py', |
22 r'incremental_install/.*\.py', | 25 r'incremental_install/.*\.py', |
23 ] | 26 ] |
24 output.extend(input_api.canned_checks.RunPylint( | 27 output.extend(input_api.canned_checks.RunPylint( |
25 input_api, | 28 input_api, |
26 output_api, | 29 output_api, |
27 pylintrc='pylintrc', | 30 pylintrc='pylintrc', |
28 # symbols has its own PRESUBMIT.py | 31 # symbols has its own PRESUBMIT.py |
29 black_list=build_pys + [r'pylib/symbols/.*\.py$'], | 32 black_list=build_pys + [r'pylib/symbols/.*\.py$'], |
30 extra_paths_list=[J(), J('buildbot')])) | 33 extra_paths_list=[J(), J('buildbot')])) |
31 output.extend(input_api.canned_checks.RunPylint( | 34 output.extend(input_api.canned_checks.RunPylint( |
32 input_api, | 35 input_api, |
33 output_api, | 36 output_api, |
34 white_list=build_pys, | 37 white_list=build_pys, |
35 extra_paths_list=[J('gyp'), J('gn')])) | 38 extra_paths_list=[J('gyp'), J('gn')])) |
36 | 39 |
37 # Disabled due to http://crbug.com/410936 | 40 # Disabled due to http://crbug.com/410936 |
38 #output.extend(input_api.canned_checks.RunUnitTestsInDirectory( | 41 #output.extend(input_api.canned_checks.RunUnitTestsInDirectory( |
39 #input_api, output_api, J('buildbot', 'tests'))) | 42 #input_api, output_api, J('buildbot', 'tests'))) |
40 | 43 |
41 pylib_test_env = dict(input_api.environ) | 44 pylib_test_env = dict(input_api.environ) |
42 pylib_test_env.update({ | 45 pylib_test_env.update({ |
43 'PYTHONPATH': input_api.PresubmitLocalPath(), | 46 'PYTHONPATH': build_android_dir, |
44 'PYTHONDONTWRITEBYTECODE': '1', | 47 'PYTHONDONTWRITEBYTECODE': '1', |
45 }) | 48 }) |
46 output.extend(input_api.canned_checks.RunUnitTests( | 49 output.extend(input_api.canned_checks.RunUnitTests( |
47 input_api, | 50 input_api, |
48 output_api, | 51 output_api, |
49 unit_tests=[ | 52 unit_tests=[ |
50 J('.', 'emma_coverage_stats_test.py'), | 53 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'), | |
57 J('gyp', 'util', 'md5_check_test.py'), | 54 J('gyp', 'util', 'md5_check_test.py'), |
58 J('pylib', 'base', 'test_dispatcher_unittest.py'), | 55 J('pylib', 'base', 'test_dispatcher_unittest.py'), |
59 J('pylib', 'gtest', 'gtest_test_instance_test.py'), | 56 J('pylib', 'gtest', 'gtest_test_instance_test.py'), |
60 J('pylib', 'instrumentation', | 57 J('pylib', 'instrumentation', |
61 'instrumentation_test_instance_test.py'), | 58 'instrumentation_test_instance_test.py'), |
62 J('pylib', 'results', 'json_results_test.py'), | 59 J('pylib', 'results', 'json_results_test.py'), |
63 ], | 60 ], |
64 env=pylib_test_env)) | 61 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)) |
65 return output | 82 return output |
66 | 83 |
67 | 84 |
68 def CheckChangeOnUpload(input_api, output_api): | 85 def CheckChangeOnUpload(input_api, output_api): |
69 return CommonChecks(input_api, output_api) | 86 return CommonChecks(input_api, output_api) |
70 | 87 |
71 | 88 |
72 def CheckChangeOnCommit(input_api, output_api): | 89 def CheckChangeOnCommit(input_api, output_api): |
73 return CommonChecks(input_api, output_api) | 90 return CommonChecks(input_api, output_api) |
OLD | NEW |