| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 """API for the bisect recipe module. | 5 """API for the bisect recipe module. |
| 6 | 6 |
| 7 This API is meant to enable the bisect recipe to bisect any chromium-supported | 7 This API is meant to enable the bisect recipe to bisect any chromium-supported |
| 8 platform for any test that can be run via buildbot, perf or otherwise. | 8 platform for any test that can be run via buildbot, perf or otherwise. |
| 9 """ | 9 """ |
| 10 | 10 |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 args += [ | 133 args += [ |
| 134 '--build-properties', | 134 '--build-properties', |
| 135 self.m.json.dumps(dict(self.m.properties.legacy())), | 135 self.m.json.dumps(dict(self.m.properties.legacy())), |
| 136 ] | 136 ] |
| 137 self.m.chromium.runtest( | 137 self.m.chromium.runtest( |
| 138 self.m.path['checkout'].join('tools', 'run-bisect-perf-regression.py'), | 138 self.m.path['checkout'].join('tools', 'run-bisect-perf-regression.py'), |
| 139 ['-w', self.m.path['slave_build']] + args, | 139 ['-w', self.m.path['slave_build']] + args, |
| 140 name='Running Bisection', | 140 name='Running Bisection', |
| 141 xvfb=True, **kwargs) | 141 xvfb=True, **kwargs) |
| 142 | 142 |
| 143 def run_local_test_run(self, api, test_config_params, | 143 def run_local_test_run(self, api, test_config_params): # pragma: no cover |
| 144 skip_download=False): # pragma: no cover | |
| 145 """Starts a test run on the same machine. | 144 """Starts a test run on the same machine. |
| 146 | 145 |
| 147 This is for the merged director/tester flow. | 146 This is for the merged director/tester flow. |
| 148 """ | 147 """ |
| 149 if self.m.platform.is_win: | 148 if self.m.platform.is_win: |
| 150 self.m.chromium.taskkill() | 149 self.m.chromium.taskkill() |
| 151 | 150 update_step = api.bot_update.ensure_checkout( |
| 152 if skip_download: | 151 root_solution_revision=test_config_params['revision']) |
| 153 update_step = None | |
| 154 else: | |
| 155 update_step = api.bot_update.ensure_checkout( | |
| 156 root_solution_revision=test_config_params['revision']) | |
| 157 self.start_test_run_for_bisect(api, update_step, self.bot_db, | 152 self.start_test_run_for_bisect(api, update_step, self.bot_db, |
| 158 test_config_params, run_locally=True, | 153 test_config_params, run_locally=True) |
| 159 skip_download=skip_download) | |
| 160 | 154 |
| 161 def start_test_run_for_bisect(self, api, update_step, bot_db, | 155 def start_test_run_for_bisect(self, api, update_step, bot_db, |
| 162 test_config_params, run_locally=False, | 156 test_config_params, run_locally=False): |
| 163 skip_download=False): | |
| 164 mastername = api.properties.get('mastername') | 157 mastername = api.properties.get('mastername') |
| 165 buildername = api.properties.get('buildername') | 158 buildername = api.properties.get('buildername') |
| 166 bot_config = bot_db.get_bot_config(mastername, buildername) | 159 bot_config = bot_db.get_bot_config(mastername, buildername) |
| 167 build_archive_url = test_config_params['parent_build_archive_url'] | 160 build_archive_url = test_config_params['parent_build_archive_url'] |
| 168 if not run_locally: | 161 if not run_locally: |
| 169 api.bisect_tester.upload_job_url() | 162 api.bisect_tester.upload_job_url() |
| 170 if not skip_download: | 163 if api.chromium.c.TARGET_PLATFORM == 'android': |
| 171 if api.chromium.c.TARGET_PLATFORM == 'android': | 164 # The best way to ensure the old build directory is not used is to |
| 172 # The best way to ensure the old build directory is not used is to | 165 # remove it. |
| 173 # remove it. | 166 build_dir = self.m.chromium.c.build_dir.join( |
| 174 build_dir = self.m.chromium.c.build_dir.join( | 167 self.m.chromium.c.build_config_fs) |
| 175 self.m.chromium.c.build_config_fs) | 168 self.m.file.rmtree('build directory', build_dir) |
| 176 self.m.file.rmtree('build directory', build_dir) | |
| 177 | 169 |
| 178 # The way android builders on tryserver.chromium.perf are archived is | 170 # The way android builders on tryserver.chromium.perf are archived is |
| 179 # different from builders on chromium.perf. In order to support both | 171 # different from builders on chromium.perf. In order to support both |
| 180 # forms of archives, we added this temporary hack until builders are | 172 # forms of archives, we added this temporary hack until builders are |
| 181 # fixed. See http://crbug.com/535218. | 173 # fixed. See http://crbug.com/535218. |
| 182 zip_dir = self.m.path.join(self.m.path['checkout'], 'full-build-linux') | 174 zip_dir = self.m.path.join(self.m.path['checkout'], 'full-build-linux') |
| 183 if self.m.path.exists(zip_dir): # pragma: no cover | 175 if self.m.path.exists(zip_dir): # pragma: no cover |
| 184 self.m.file.rmtree('full-build-linux directory', zip_dir) | 176 self.m.file.rmtree('full-build-linux directory', zip_dir) |
| 185 | 177 |
| 186 gs_bucket = 'gs://%s/' % bot_config['bucket'] | 178 gs_bucket = 'gs://%s/' % bot_config['bucket'] |
| 187 archive_path = build_archive_url[len(gs_bucket):] | 179 archive_path = build_archive_url[len(gs_bucket):] |
| 188 api.chromium_android.download_build( | 180 api.chromium_android.download_build( |
| 189 bucket=bot_config['bucket'], | 181 bucket=bot_config['bucket'], |
| 190 path=archive_path) | 182 path=archive_path) |
| 191 | 183 |
| 192 # The way android builders on tryserver.chromium.perf are archived is | 184 # The way android builders on tryserver.chromium.perf are archived is |
| 193 # different from builders on chromium.perf. In order to support both | 185 # different from builders on chromium.perf. In order to support both |
| 194 # forms of archives, we added this temporary hack until builders are | 186 # forms of archives, we added this temporary hack until builders are |
| 195 # fixed. See http://crbug.com/535218. | 187 # fixed. See http://crbug.com/535218. |
| 196 if self.m.path.exists(zip_dir): # pragma: no cover | 188 if self.m.path.exists(zip_dir): # pragma: no cover |
| 197 self.m.python.inline( | 189 self.m.python.inline( |
| 198 'moving full-build-linux to out/Release', | 190 'moving full-build-linux to out/Release', |
| 199 """ | 191 """ |
| 200 import shutil | 192 import shutil |
| 201 import sys | 193 import sys |
| 202 shutil.move(sys.argv[1], sys.argv[2]) | 194 shutil.move(sys.argv[1], sys.argv[2]) |
| 203 """, | 195 """, |
| 204 args=[zip_dir, build_dir]) | 196 args=[zip_dir, build_dir]) |
| 205 else: | 197 else: |
| 206 api.chromium_tests.download_and_unzip_build( | 198 api.chromium_tests.download_and_unzip_build( |
| 207 mastername, buildername, update_step, bot_db, | 199 mastername, buildername, update_step, bot_db, |
| 208 build_archive_url=build_archive_url, | 200 build_archive_url=build_archive_url, |
| 209 build_revision=test_config_params['parent_got_revision'], | 201 build_revision=test_config_params['parent_got_revision'], |
| 210 override_bot_type='tester') | 202 override_bot_type='tester') |
| 211 | 203 |
| 212 tests = [api.chromium_tests.steps.BisectTest(test_config_params)] | 204 tests = [api.chromium_tests.steps.BisectTest(test_config_params)] |
| 213 | 205 |
| 214 if not tests: # pragma: no cover | 206 if not tests: # pragma: no cover |
| 215 return | 207 return |
| 216 api.chromium_tests.configure_swarming( # pragma: no cover | 208 api.chromium_tests.configure_swarming( # pragma: no cover |
| 217 'chromium', precommit=False, mastername=mastername) | 209 'chromium', precommit=False, mastername=mastername) |
| 218 test_runner = api.chromium_tests.create_test_runner(api, tests) | 210 test_runner = api.chromium_tests.create_test_runner(api, tests) |
| 219 | 211 |
| 220 bot_config_object = api.chromium_tests.create_bot_config_object( | 212 bot_config_object = api.chromium_tests.create_bot_config_object( |
| 221 mastername, buildername) | 213 mastername, buildername) |
| 222 with api.chromium_tests.wrap_chromium_tests(bot_config_object, tests): | 214 with api.chromium_tests.wrap_chromium_tests(bot_config_object, tests): |
| 223 if api.chromium.c.TARGET_PLATFORM == 'android' and not skip_download: | 215 if api.chromium.c.TARGET_PLATFORM == 'android': |
| 224 if bot_config.get('webview'): | 216 if bot_config.get('webview'): |
| 225 api.chromium_android.adb_install_apk('SystemWebView.apk') | 217 api.chromium_android.adb_install_apk('SystemWebView.apk') |
| 226 api.chromium_android.adb_install_apk('SystemWebViewShell.apk') | 218 api.chromium_android.adb_install_apk('SystemWebViewShell.apk') |
| 227 else: | 219 else: |
| 228 api.chromium_android.adb_install_apk('ChromePublic.apk') | 220 api.chromium_android.adb_install_apk('ChromePublic.apk') |
| 229 test_runner() | 221 test_runner() |
| 230 | 222 |
| 231 def start_try_job(self, api, update_step=None, bot_db=None, **kwargs): | 223 def start_try_job(self, api, update_step=None, bot_db=None, **kwargs): |
| 232 """Starts a recipe bisect job, perf test run, or legacy bisect run. | 224 """Starts a recipe bisect job, perf test run, or legacy bisect run. |
| 233 | 225 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 local_bisect.perform_bisect(self) # pragma: no cover | 261 local_bisect.perform_bisect(self) # pragma: no cover |
| 270 else: | 262 else: |
| 271 self.start_test_run_for_bisect(api, update_step, self.bot_db, | 263 self.start_test_run_for_bisect(api, update_step, self.bot_db, |
| 272 api.properties) | 264 api.properties) |
| 273 else: | 265 else: |
| 274 self.m.perf_try.start_perf_try_job( | 266 self.m.perf_try.start_perf_try_job( |
| 275 affected_files, update_step, self.bot_db) | 267 affected_files, update_step, self.bot_db) |
| 276 finally: | 268 finally: |
| 277 if api.chromium.c.TARGET_PLATFORM == 'android': | 269 if api.chromium.c.TARGET_PLATFORM == 'android': |
| 278 api.chromium_android.common_tests_final_steps() | 270 api.chromium_android.common_tests_final_steps() |
| OLD | NEW |