OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 import collections | 7 import collections |
8 import json | 8 import json |
9 import optparse | 9 import optparse |
10 import os | 10 import os |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 for test in test_obj.tests: | 59 for test in test_obj.tests: |
60 run_test_cmd.extend(['-f', test]) | 60 run_test_cmd.extend(['-f', test]) |
61 if test_obj.extra_args: | 61 if test_obj.extra_args: |
62 run_test_cmd.extend(test_obj.extra_args) | 62 run_test_cmd.extend(test_obj.extra_args) |
63 commands.append(Command('Run tests', run_test_cmd)) | 63 commands.append(Command('Run tests', run_test_cmd)) |
64 | 64 |
65 return commands | 65 return commands |
66 | 66 |
67 | 67 |
68 def GetBotStepMap(): | 68 def GetBotStepMap(): |
| 69 compile_step = ['bb_compile'] |
69 std_build_steps = ['bb_compile', 'bb_zip_build'] | 70 std_build_steps = ['bb_compile', 'bb_zip_build'] |
70 std_test_steps = ['bb_extract_build', 'bb_reboot_phones'] | 71 std_test_steps = ['bb_extract_build', 'bb_reboot_phones'] |
71 std_tests = ['ui', 'unit'] | 72 std_tests = ['ui', 'unit'] |
72 | 73 |
73 B = BotConfig | 74 B = BotConfig |
74 def T(tests, extra_args=None): | 75 def T(tests, extra_args=None): |
75 return TestConfig(tests, extra_args) | 76 return TestConfig(tests, extra_args) |
76 | 77 |
77 bot_configs = [ | 78 bot_configs = [ |
78 # Main builders | 79 # Main builders |
79 B('main-builder-dbg', | 80 B('main-builder-dbg', |
80 ['bb_compile', 'bb_run_findbugs', 'bb_zip_build'], None, None), | 81 ['bb_compile', 'bb_run_findbugs', 'bb_zip_build'], None, None), |
81 B('main-builder-rel', std_build_steps, None, None), | 82 B('main-builder-rel', compile_step, None, None), |
82 B('main-clang-builder', ['bb_compile'], None, None), | 83 B('main-clang-builder', compile_step, None, None), |
83 B('main-clobber', ['bb_compile'], None, None), | 84 B('main-clobber', compile_step, None, None), |
84 B('main-tests-dbg', std_test_steps, T(std_tests), None), | 85 B('main-tests-dbg', std_test_steps, T(std_tests), None), |
85 | 86 |
86 # Other waterfalls | 87 # Other waterfalls |
87 B('asan-builder', std_build_steps, None, None), | 88 B('asan-builder', std_build_steps, None, None), |
88 B('asan-tests', std_test_steps, T(std_tests, ['--asan']), None), | 89 B('asan-tests', std_test_steps, T(std_tests, ['--asan']), None), |
89 B('fyi-builder-dbg', | 90 B('fyi-builder-dbg', |
90 ['bb_check_webview_licenses', 'bb_compile', 'bb_compile_experimental', | 91 ['bb_check_webview_licenses', 'bb_compile', 'bb_compile_experimental', |
91 'bb_run_findbugs', 'bb_zip_build'], None, None), | 92 'bb_run_findbugs', 'bb_zip_build'], None, None), |
92 B('fyi-builder-rel', | 93 B('fyi-builder-rel', |
93 ['bb_compile', 'bb_compile_experimental', 'bb_zip_build'], None, None), | 94 ['bb_compile', 'bb_compile_experimental', 'bb_zip_build'], None, None), |
94 B('fyi-tests', std_test_steps, T(std_tests, ['--experimental']), None), | 95 B('fyi-tests', std_test_steps, T(std_tests, ['--experimental']), None), |
95 B('perf-builder-rel', std_build_steps, None, None), | |
96 B('perf-tests-rel', std_test_steps, T([], ['--install=ContentShell']), | 96 B('perf-tests-rel', std_test_steps, T([], ['--install=ContentShell']), |
97 None), | 97 None), |
98 B('webkit-latest-builder', std_build_steps, None, None), | |
99 B('webkit-latest-tests', std_test_steps, T(['unit']), None), | 98 B('webkit-latest-tests', std_test_steps, T(['unit']), None), |
100 B('webkit-latest-webkit-tests', std_test_steps, | 99 B('webkit-latest-webkit-tests', std_test_steps, |
101 T(['webkit_layout', 'webkit']), None), | 100 T(['webkit_layout', 'webkit']), None), |
| 101 |
| 102 # Generic builder config (for substring match). |
| 103 B('builder', std_build_steps, None, None), |
102 ] | 104 ] |
103 | 105 |
104 bot_map = dict((config.bot_id, config) for config in bot_configs) | 106 bot_map = dict((config.bot_id, config) for config in bot_configs) |
105 | 107 |
106 # These bots have identical configuration to ones defined earlier. | 108 # These bots have identical configuration to ones defined earlier. |
107 copy_map = [ | 109 copy_map = [ |
108 ('try-builder-dbg', 'main-builder-dbg'), | 110 ('try-builder-dbg', 'main-builder-dbg'), |
109 ('try-tests-dbg', 'main-tests-dbg'), | 111 ('try-tests-dbg', 'main-tests-dbg'), |
110 ('try-clang-builder', 'main-clang-builder'), | 112 ('try-clang-builder', 'main-clang-builder'), |
111 ('try-fyi-builder-dbg', 'fyi-builder-dbg'), | 113 ('try-fyi-builder-dbg', 'fyi-builder-dbg'), |
(...skipping 19 matching lines...) Expand all Loading... |
131 parser.add_option('--factory-properties', action='callback', | 133 parser.add_option('--factory-properties', action='callback', |
132 callback=ConvertJson, type='string', default={}, | 134 callback=ConvertJson, type='string', default={}, |
133 help='factory properties in JSON format') | 135 help='factory properties in JSON format') |
134 parser.add_option('--bot-id', help='Specify bot id directly.') | 136 parser.add_option('--bot-id', help='Specify bot id directly.') |
135 parser.add_option('--TESTING', action='store_true', | 137 parser.add_option('--TESTING', action='store_true', |
136 help='For testing: print, but do not run commands') | 138 help='For testing: print, but do not run commands') |
137 options, args = parser.parse_args(argv[1:]) | 139 options, args = parser.parse_args(argv[1:]) |
138 if args: | 140 if args: |
139 parser.error('Unused args: %s' % args) | 141 parser.error('Unused args: %s' % args) |
140 | 142 |
141 bot_id = options.bot_id or options.factory_properties.get('bot_id') | 143 bot_id = options.bot_id or options.factory_properties.get('android_bot_id') |
142 if not bot_id: | 144 if not bot_id: |
143 parser.error('A bot id must be specified through option or factory_props.') | 145 parser.error('A bot id must be specified through option or factory_props.') |
144 | 146 |
145 # Get a BotConfig object looking first for an exact bot-id match. If no exact | 147 # Get a BotConfig object looking first for an exact bot-id match. If no exact |
146 # match, look for a bot-id which is a substring of the specified id. | 148 # match, look for a bot-id which is a substring of the specified id. |
147 # This allows similar bots can have unique IDs, but to share config. | 149 # This allows similar bots to have unique IDs, but to share config. |
| 150 # If multiple substring matches exist, pick the longest one. |
148 bot_map = GetBotStepMap() | 151 bot_map = GetBotStepMap() |
149 bot_config = bot_map.get(bot_id) | 152 bot_config = bot_map.get(bot_id) |
150 if not bot_config: | 153 if not bot_config: |
151 for cur_id, cur_config in bot_map.iteritems(): | 154 substring_matches = filter(lambda x: x in bot_id, bot_map.iterkeys()) |
152 if cur_id in bot_id: | 155 if substring_matches: |
153 print 'Using config from id="%s" (substring match).' % cur_id | 156 max_id = max(substring_matches, key=len) |
154 bot_config = cur_config | 157 print 'Using config from id="%s" (substring match).' % max_id |
155 break | 158 bot_config = bot_map[max_id] |
156 if not bot_config: | 159 if not bot_config: |
157 print 'Error: config for id="%s" cannot be inferred.' % bot_id | 160 print 'Error: config for id="%s" cannot be inferred.' % bot_id |
158 return 1 | 161 return 1 |
159 | 162 |
160 print 'Using config:', bot_config | 163 print 'Using config:', bot_config |
161 | 164 |
162 def CommandToString(command): | 165 def CommandToString(command): |
163 """Returns quoted command that can be run in bash shell.""" | 166 """Returns quoted command that can be run in bash shell.""" |
164 return ' '.join(map(pipes.quote, command)) | 167 return ' '.join(map(pipes.quote, command)) |
165 | 168 |
(...skipping 15 matching lines...) Expand all Loading... |
181 continue | 184 continue |
182 env = dict(os.environ) | 185 env = dict(os.environ) |
183 env['BUILDBOT_TESTING'] = '1' | 186 env['BUILDBOT_TESTING'] = '1' |
184 | 187 |
185 return_code |= subprocess.call(command, cwd=CHROME_SRC, env=env) | 188 return_code |= subprocess.call(command, cwd=CHROME_SRC, env=env) |
186 return return_code | 189 return return_code |
187 | 190 |
188 | 191 |
189 if __name__ == '__main__': | 192 if __name__ == '__main__': |
190 sys.exit(main(sys.argv)) | 193 sys.exit(main(sys.argv)) |
OLD | NEW |