OLD | NEW |
| (Empty) |
1 # Copyright 2014 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 DEPS = [ | |
6 'archive', | |
7 'base_android', | |
8 'bot_update', | |
9 'chromium', | |
10 'chromium_android', | |
11 'gclient', | |
12 'json', | |
13 'path', | |
14 'platform', | |
15 'properties', | |
16 'python', | |
17 'step', | |
18 'tryserver', | |
19 'webrtc', | |
20 ] | |
21 | |
22 | |
23 def GenSteps(api): | |
24 mastername = api.properties.get('mastername') | |
25 buildername = api.properties.get('buildername') | |
26 master_dict = api.webrtc.BUILDERS.get(mastername, {}) | |
27 bot_config = master_dict.get('builders', {}).get(buildername) | |
28 assert bot_config, ('Unrecognized builder name %r for master %r.' % | |
29 (buildername, mastername)) | |
30 recipe_config_name = bot_config['recipe_config'] | |
31 recipe_config = api.webrtc.RECIPE_CONFIGS.get(recipe_config_name) | |
32 assert recipe_config, ('Cannot find recipe_config "%s" for builder "%r".' % | |
33 (recipe_config_name, buildername)) | |
34 | |
35 # The infrastructure team has recommended not to use git yet on the | |
36 # bots, but it's very nice to have when testing locally. | |
37 # To use, pass "use_git=True" as an argument to run_recipe.py. | |
38 use_git = api.properties.get('use_git', False) | |
39 | |
40 api.webrtc.set_config(recipe_config['webrtc_config'], | |
41 GIT_MODE=use_git, | |
42 **bot_config.get('webrtc_config_kwargs', {})) | |
43 if api.tryserver.is_tryserver: | |
44 api.webrtc.apply_config('webrtc_android_apk_try_builder') | |
45 | |
46 bot_type = bot_config.get('bot_type', 'builder_tester') | |
47 does_build = bot_type in ('builder', 'builder_tester') | |
48 does_test = bot_type in ('builder_tester', 'tester') | |
49 | |
50 # Replace src/third_party/webrtc with the specified revision and force the | |
51 # Chromium code to sync ToT. | |
52 s = api.gclient.c.solutions | |
53 s[0].revision = 'HEAD' | |
54 | |
55 # Revision to be used for SVN-based checkouts and passing builds between | |
56 # builders/testers. | |
57 # For forced builds, revision is empty, in which case we sync HEAD. | |
58 if bot_type == 'tester': | |
59 webrtc_revision = api.properties.get('parent_got_revision') | |
60 assert webrtc_revision, ( | |
61 'Testers cannot be forced without providing revision information. Please' | |
62 'select a previous build and click [Rebuild] or force a build for a ' | |
63 'Builder instead (will trigger new runs for the testers).') | |
64 else: | |
65 # For forced builds, revision is empty, in which case we sync HEAD. | |
66 webrtc_revision = api.properties.get('revision', 'HEAD') | |
67 | |
68 # This is only used by SVN-based checkouts. | |
69 # TODO(kjellander): Remove this when these bots are switched to bot_update. | |
70 s[0].custom_vars['webrtc_revision'] = webrtc_revision | |
71 | |
72 # Since bot_update uses separate Git mirrors for the webrtc and libjingle | |
73 # repos, they cannot use the revision we get from the poller, since it won't | |
74 # be present in both if there's a revision that only contains changes in one | |
75 # of them. For now, work around this by always syncing HEAD for both. | |
76 api.gclient.c.revisions.update({ | |
77 'src/third_party/webrtc': 'HEAD', | |
78 'src/third_party/libjingle/source/talk': 'HEAD', | |
79 }) | |
80 | |
81 # TODO(tandrii,iannucci): Support webrtc.apply_svn_patch with bot_update. | |
82 # crbug.com/376122 | |
83 # For now, ignore all patches in bot_update, and apply_svn_patch always. | |
84 step_result = api.bot_update.ensure_checkout(patch=False) | |
85 | |
86 api.webrtc.cleanup() | |
87 | |
88 # Whatever step is run right before this line needs to emit got_revision. | |
89 update_step = step_result | |
90 got_revision = update_step.presentation.properties['got_revision'] | |
91 | |
92 # Until crbug.com/376122 is resolved, run apply_svn_patch after bot_update. | |
93 if does_build and api.tryserver.is_tryserver: | |
94 api.webrtc.apply_svn_patch() | |
95 | |
96 if does_build: | |
97 api.base_android.envsetup() | |
98 | |
99 # WebRTC Android APK testers also have to run the runhooks, since test | |
100 # resources are currently downloaded during this step. | |
101 api.base_android.runhooks() | |
102 | |
103 api.chromium.cleanup_temp() | |
104 if does_build: | |
105 api.base_android.compile() | |
106 | |
107 # Can't use webrtc_revision when passing builds between builders and testers | |
108 # since it will differ between builder and tester syncs if additional | |
109 # revisions are committed between their runs. | |
110 archive_rev = got_revision if webrtc_revision == 'HEAD' else webrtc_revision | |
111 if bot_type == 'builder': | |
112 api.webrtc.package_build( | |
113 api.webrtc.GS_ARCHIVES[bot_config['build_gs_archive']], archive_rev) | |
114 | |
115 if bot_type == 'tester': | |
116 api.webrtc.extract_build( | |
117 api.webrtc.GS_ARCHIVES[bot_config['build_gs_archive']], archive_rev) | |
118 | |
119 if does_test: | |
120 api.chromium_android.common_tests_setup_steps() | |
121 #TODO(martiniss) convert loop | |
122 for test in api.webrtc.ANDROID_APK_TESTS: | |
123 api.base_android.test_runner(test) | |
124 | |
125 api.chromium_android.common_tests_final_steps() | |
126 | |
127 | |
128 def _sanitize_nonalpha(text): | |
129 return ''.join(c if c.isalnum() else '_' for c in text) | |
130 | |
131 | |
132 def GenTests(api): | |
133 def generate_builder(mastername, buildername, bot_config, revision=None, | |
134 parent_got_revision=None, suffix=None): | |
135 suffix = suffix or '' | |
136 bot_type = bot_config.get('bot_type', 'builder_tester') | |
137 if bot_type in ('builder', 'builder_tester'): | |
138 assert bot_config.get('parent_buildername') is None, ( | |
139 'Unexpected parent_buildername for builder %r on master %r.' % | |
140 (buildername, mastername)) | |
141 | |
142 webrtc_config_kwargs = bot_config.get('webrtc_config_kwargs', {}) | |
143 test = ( | |
144 api.test('%s_%s%s' % (_sanitize_nonalpha(mastername), | |
145 _sanitize_nonalpha(buildername), suffix)) + | |
146 api.properties(mastername=mastername, | |
147 buildername=buildername, | |
148 slavename='fake_slavename', | |
149 parent_buildername=bot_config.get('parent_buildername'), | |
150 TARGET_PLATFORM=webrtc_config_kwargs['TARGET_PLATFORM'], | |
151 TARGET_ARCH=webrtc_config_kwargs['TARGET_ARCH'], | |
152 TARGET_BITS=webrtc_config_kwargs['TARGET_BITS'], | |
153 BUILD_CONFIG=webrtc_config_kwargs['BUILD_CONFIG']) + | |
154 api.platform(bot_config['testing']['platform'], | |
155 webrtc_config_kwargs.get('TARGET_BITS', 64)) | |
156 ) | |
157 if bot_type in ('builder', 'builder_tester'): | |
158 test += api.step_data('envsetup', | |
159 api.json.output({ | |
160 'FOO': 'bar', | |
161 'GYP_DEFINES': 'my_new_gyp_def=aaa', | |
162 })) | |
163 | |
164 if revision: | |
165 test += api.properties(revision=revision) | |
166 if bot_type == 'tester': | |
167 parent_rev = parent_got_revision or revision | |
168 test += api.properties(parent_got_revision=parent_rev) | |
169 | |
170 if mastername.startswith('tryserver'): | |
171 test += api.properties(patch_url='try_job_svn_patch') | |
172 | |
173 return test | |
174 | |
175 for mastername in ('client.webrtc', 'tryserver.webrtc'): | |
176 master_config = api.webrtc.BUILDERS[mastername] | |
177 for buildername, bot_config in master_config['builders'].iteritems(): | |
178 if bot_config['recipe_config'] != 'webrtc_android_apk': | |
179 continue | |
180 yield generate_builder(mastername, buildername, bot_config, | |
181 revision='12345') | |
182 | |
183 # Forced build (no revision information). | |
184 mastername = 'client.webrtc' | |
185 buildername = 'Android Chromium-APK Builder' | |
186 bot_config = api.webrtc.BUILDERS[mastername]['builders'][buildername] | |
187 yield generate_builder(mastername, buildername, bot_config, revision=None, | |
188 suffix='_forced') | |
189 | |
190 buildername = 'Android Chromium-APK Tests (KK Nexus5)' | |
191 bot_config = api.webrtc.BUILDERS[mastername]['builders'][buildername] | |
192 yield generate_builder(mastername, buildername, bot_config, revision=None, | |
193 parent_got_revision='12345', suffix='_forced') | |
OLD | NEW |