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