| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 self.m.path['checkout'].join('tools', 'run-bisect-perf-regression.py'), | 124 self.m.path['checkout'].join('tools', 'run-bisect-perf-regression.py'), |
| 125 ['-w', self.m.path['slave_build']] + args, | 125 ['-w', self.m.path['slave_build']] + args, |
| 126 name='Running Bisection', | 126 name='Running Bisection', |
| 127 xvfb=True, **kwargs) | 127 xvfb=True, **kwargs) |
| 128 | 128 |
| 129 def run_local_test_run(self, api, test_config_params): # pragma: no cover | 129 def run_local_test_run(self, api, test_config_params): # pragma: no cover |
| 130 mastername = api.properties.get('mastername') | 130 mastername = api.properties.get('mastername') |
| 131 buildername = api.properties.get('buildername') | 131 buildername = api.properties.get('buildername') |
| 132 api.chromium_tests.configure_build(mastername, buildername) | 132 api.chromium_tests.configure_build(mastername, buildername) |
| 133 api.gclient.apply_config('perf') | 133 api.gclient.apply_config('perf') |
| 134 update_step, master_dict, _ = \ | 134 update_step, bot_db = \ |
| 135 api.chromium_tests.prepare_checkout( | 135 api.chromium_tests.prepare_checkout( |
| 136 mastername, buildername, | 136 mastername, buildername, |
| 137 root_solution_revision=test_config_params['revision']) | 137 root_solution_revision=test_config_params['revision']) |
| 138 self.start_test_run_for_bisect(api, update_step, master_dict, | 138 self.start_test_run_for_bisect(api, update_step, bot_db, |
| 139 test_config_params, run_locally=True) | 139 test_config_params, run_locally=True) |
| 140 | 140 |
| 141 def start_test_run_for_bisect(self, api, update_step, master_dict, | 141 def start_test_run_for_bisect(self, api, update_step, bot_db, |
| 142 test_config_params, run_locally=False): | 142 test_config_params, run_locally=False): |
| 143 mastername = api.properties.get('mastername') | 143 mastername = api.properties.get('mastername') |
| 144 buildername = api.properties.get('buildername') | 144 buildername = api.properties.get('buildername') |
| 145 bot_config = master_dict.get('builders', {}).get(buildername) | 145 bot_config = bot_db.get_bot_config(mastername, buildername) |
| 146 if not run_locally: | 146 if not run_locally: |
| 147 api.bisect_tester.upload_job_url() | 147 api.bisect_tester.upload_job_url() |
| 148 if api.chromium.c.TARGET_PLATFORM == 'android': | 148 if api.chromium.c.TARGET_PLATFORM == 'android': |
| 149 # The best way to ensure the old build directory is not used is to | 149 # The best way to ensure the old build directory is not used is to |
| 150 # remove it. | 150 # remove it. |
| 151 build_dir = self.m.chromium.c.build_dir.join( | 151 build_dir = self.m.chromium.c.build_dir.join( |
| 152 self.m.chromium.c.build_config_fs) | 152 self.m.chromium.c.build_config_fs) |
| 153 self.m.file.rmtree('build directory', build_dir) | 153 self.m.file.rmtree('build directory', build_dir) |
| 154 | 154 |
| 155 # crbug.com/535218, the way android builders on tryserver.chromium.perf | 155 # crbug.com/535218, the way android builders on tryserver.chromium.perf |
| (...skipping 16 matching lines...) Expand all Loading... |
| 172 'moving full-build-linux to out/Release ', | 172 'moving full-build-linux to out/Release ', |
| 173 """ | 173 """ |
| 174 import shutil | 174 import shutil |
| 175 import sys | 175 import sys |
| 176 shutil.move(sys.argv[1], sys.argv[2]) | 176 shutil.move(sys.argv[1], sys.argv[2]) |
| 177 """, | 177 """, |
| 178 args=[zip_dir, build_dir], | 178 args=[zip_dir, build_dir], |
| 179 ) | 179 ) |
| 180 else: | 180 else: |
| 181 api.chromium_tests.download_and_unzip_build( | 181 api.chromium_tests.download_and_unzip_build( |
| 182 mastername, buildername, update_step, master_dict, | 182 mastername, buildername, update_step, bot_db, |
| 183 build_archive_url=test_config_params['parent_build_archive_url'], | 183 build_archive_url=test_config_params['parent_build_archive_url'], |
| 184 build_revision=test_config_params['parent_got_revision'], | 184 build_revision=test_config_params['parent_got_revision'], |
| 185 override_bot_type='tester') | 185 override_bot_type='tester') |
| 186 | 186 |
| 187 api.chromium_tests.tests_for_builder( | 187 api.chromium_tests.tests_for_builder( |
| 188 mastername, buildername, update_step, master_dict, | 188 mastername, buildername, update_step, bot_db, |
| 189 override_bot_type='tester') | 189 override_bot_type='tester') |
| 190 | 190 |
| 191 tests = [api.chromium_tests.steps.BisectTest(test_config_params)] | 191 tests = [api.chromium_tests.steps.BisectTest(test_config_params)] |
| 192 | 192 |
| 193 if not tests: # pragma: no cover | 193 if not tests: # pragma: no cover |
| 194 return | 194 return |
| 195 api.chromium_tests.configure_swarming( # pragma: no cover | 195 api.chromium_tests.configure_swarming( # pragma: no cover |
| 196 'chromium', precommit=False, mastername=mastername) | 196 'chromium', precommit=False, mastername=mastername) |
| 197 test_runner = api.chromium_tests.create_test_runner(api, tests) | 197 test_runner = api.chromium_tests.create_test_runner(api, tests) |
| 198 | 198 |
| 199 with api.chromium_tests.wrap_chromium_tests(mastername, tests): | 199 with api.chromium_tests.wrap_chromium_tests(mastername, tests): |
| 200 if api.chromium.c.TARGET_PLATFORM == 'android': | 200 if api.chromium.c.TARGET_PLATFORM == 'android': |
| 201 api.chromium_android.adb_install_apk('ChromePublic.apk') | 201 api.chromium_android.adb_install_apk('ChromePublic.apk') |
| 202 test_runner() | 202 test_runner() |
| 203 | 203 |
| 204 def start_try_job(self, api, update_step=None, master_dict=None, **kwargs): | 204 def start_try_job(self, api, update_step=None, bot_db=None, **kwargs): |
| 205 if master_dict is None: # pragma: no cover | 205 if bot_db is None: # pragma: no cover |
| 206 master_dict = {} | 206 bot_db = api.chromium_tests.create_bot_db_from_master_dict( |
| 207 '', None, None) |
| 207 affected_files = self.m.tryserver.get_files_affected_by_patch() | 208 affected_files = self.m.tryserver.get_files_affected_by_patch() |
| 208 | 209 |
| 209 # Avoid duplication of device setup steps for bisect recipe tester which | 210 # Avoid duplication of device setup steps for bisect recipe tester which |
| 210 # is ran while executing tests in chromium_tests.wrap_chromium_tests and | 211 # is ran while executing tests in chromium_tests.wrap_chromium_tests and |
| 211 # also we don't want to execute runhooks since this just tests the build. | 212 # also we don't want to execute runhooks since this just tests the build. |
| 212 if (api.properties.get('bisect_config') is None and | 213 if (api.properties.get('bisect_config') is None and |
| 213 api.chromium.c.TARGET_PLATFORM == 'android'): | 214 api.chromium.c.TARGET_PLATFORM == 'android'): |
| 214 api.chromium_android.common_tests_setup_steps(perf_setup=True) | 215 api.chromium_android.common_tests_setup_steps(perf_setup=True) |
| 215 api.chromium.runhooks() | 216 api.chromium.runhooks() |
| 216 try: | 217 try: |
| 217 # Run legacy bisect script if the patch contains bisect.cfg. | 218 # Run legacy bisect script if the patch contains bisect.cfg. |
| 218 if BISECT_CONFIG_FILE in affected_files: | 219 if BISECT_CONFIG_FILE in affected_files: |
| 219 kwargs['extra_src'] = '' | 220 kwargs['extra_src'] = '' |
| 220 kwargs['path_to_config'] = '' | 221 kwargs['path_to_config'] = '' |
| 221 self.run_bisect_script(**kwargs) | 222 self.run_bisect_script(**kwargs) |
| 222 elif api.properties.get('bisect_config'): | 223 elif api.properties.get('bisect_config'): |
| 223 # We can distinguish between a config for a full bisect vs a single | 224 # We can distinguish between a config for a full bisect vs a single |
| 224 # test by checking for the presence of the good_revision key. | 225 # test by checking for the presence of the good_revision key. |
| 225 # Also, at the moment android is not supported and return_code mode | 226 # Also, at the moment android is not supported and return_code mode |
| 226 # does not require device affinity. | 227 # does not require device affinity. |
| 227 platform = self.m.chromium.c.TARGET_PLATFORM | 228 platform = self.m.chromium.c.TARGET_PLATFORM |
| 228 test_type = api.properties.get('bisect_config').get('test_type') | 229 test_type = api.properties.get('bisect_config').get('test_type') |
| 229 if (api.properties.get('bisect_config').get('good_revision') | 230 if (api.properties.get('bisect_config').get('good_revision') |
| 230 and platform != 'android' and test_type != 'return_code'): | 231 and platform != 'android' and test_type != 'return_code'): |
| 231 local_bisect.perform_bisect(self) # pragma: no cover | 232 local_bisect.perform_bisect(self) # pragma: no cover |
| 232 else: | 233 else: |
| 233 self.start_test_run_for_bisect(api, update_step, master_dict, | 234 self.start_test_run_for_bisect(api, update_step, bot_db, |
| 234 api.properties) | 235 api.properties) |
| 235 else: | 236 else: |
| 236 self.m.perf_try.start_perf_try_job( | 237 self.m.perf_try.start_perf_try_job( |
| 237 affected_files, update_step, master_dict) | 238 affected_files, update_step, bot_db) |
| 238 finally: | 239 finally: |
| 239 # Avoid duplication of device setup steps for bisect recipe tester, which | 240 # Avoid duplication of device setup steps for bisect recipe tester, which |
| 240 # are run while running tests in chromium_tests.wrap_chromium_tests. | 241 # are run while running tests in chromium_tests.wrap_chromium_tests. |
| 241 if (api.properties.get('bisect_config') is None and | 242 if (api.properties.get('bisect_config') is None and |
| 242 api.chromium.c.TARGET_PLATFORM == 'android'): | 243 api.chromium.c.TARGET_PLATFORM == 'android'): |
| 243 api.chromium_android.common_tests_final_steps() | 244 api.chromium_android.common_tests_final_steps() |
| OLD | NEW |