| OLD | NEW |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 from recipe_engine.types import freeze | 5 from recipe_engine.types import freeze |
| 6 from recipe_engine import recipe_api | 6 from recipe_engine import recipe_api |
| 7 from . import builders | 7 from . import builders |
| 8 from . import steps | 8 from . import steps |
| 9 | 9 |
| 10 | 10 |
| 11 class WebRTCApi(recipe_api.RecipeApi): | 11 class WebRTCApi(recipe_api.RecipeApi): |
| 12 def __init__(self, **kwargs): | 12 def __init__(self, **kwargs): |
| 13 super(WebRTCApi, self).__init__(**kwargs) | 13 super(WebRTCApi, self).__init__(**kwargs) |
| 14 self._env = {} | 14 self._env = {} |
| 15 | 15 |
| 16 # Keep track of working directory (which contains the checkout). |
| 17 # None means "default value". |
| 18 self._working_dir = None |
| 19 |
| 16 BUILDERS = builders.BUILDERS | 20 BUILDERS = builders.BUILDERS |
| 17 RECIPE_CONFIGS = builders.RECIPE_CONFIGS | 21 RECIPE_CONFIGS = builders.RECIPE_CONFIGS |
| 18 | 22 |
| 19 NORMAL_TESTS = ( | 23 NORMAL_TESTS = ( |
| 20 'audio_decoder_unittests', | 24 'audio_decoder_unittests', |
| 21 'common_audio_unittests', | 25 'common_audio_unittests', |
| 22 'common_video_unittests', | 26 'common_video_unittests', |
| 23 'modules_tests', | 27 'modules_tests', |
| 24 'modules_unittests', | 28 'modules_unittests', |
| 25 'peerconnection_unittests', | 29 'peerconnection_unittests', |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 self.m.chromium_swarming.configure_swarming( | 135 self.m.chromium_swarming.configure_swarming( |
| 132 'webrtc', | 136 'webrtc', |
| 133 precommit=self.m.tryserver.is_tryserver, | 137 precommit=self.m.tryserver.is_tryserver, |
| 134 mastername=mastername) | 138 mastername=mastername) |
| 135 self.m.swarming.set_default_dimension( | 139 self.m.swarming.set_default_dimension( |
| 136 'os', | 140 'os', |
| 137 self.m.swarming.prefered_os_dimension( | 141 self.m.swarming.prefered_os_dimension( |
| 138 self.m.platform.name).split('-', 1)[0]) | 142 self.m.platform.name).split('-', 1)[0]) |
| 139 | 143 |
| 140 def checkout(self, **kwargs): | 144 def checkout(self, **kwargs): |
| 141 checkout_dir = self.m.chromium_tests.get_checkout_dir({}) | 145 self._working_dir = self.m.chromium_tests.get_checkout_dir({}) |
| 142 if checkout_dir: | 146 if self._working_dir: |
| 143 kwargs.setdefault('cwd', checkout_dir) | 147 kwargs.setdefault('cwd', self._working_dir) |
| 144 | 148 |
| 145 update_step = self.m.bot_update.ensure_checkout(**kwargs) | 149 update_step = self.m.bot_update.ensure_checkout(**kwargs) |
| 146 assert update_step.json.output['did_run'] | 150 assert update_step.json.output['did_run'] |
| 147 | 151 |
| 148 # Whatever step is run right before this line needs to emit got_revision. | 152 # Whatever step is run right before this line needs to emit got_revision. |
| 149 revs = update_step.presentation.properties | 153 revs = update_step.presentation.properties |
| 150 self.revision = revs['got_revision'] | 154 self.revision = revs['got_revision'] |
| 151 self.revision_cp = revs['got_revision_cp'] | 155 self.revision_cp = revs['got_revision_cp'] |
| 152 self.revision_number = str(self.m.commit_position.parse_revision( | 156 self.revision_number = str(self.m.commit_position.parse_revision( |
| 153 self.revision_cp)) | 157 self.revision_cp)) |
| (...skipping 16 matching lines...) Expand all Loading... |
| 170 self.m.chromium.run_gn(use_goma=True) | 174 self.m.chromium.run_gn(use_goma=True) |
| 171 | 175 |
| 172 self.m.chromium.compile() | 176 self.m.chromium.compile() |
| 173 | 177 |
| 174 def runtests(self): | 178 def runtests(self): |
| 175 """Add a suite of test steps. | 179 """Add a suite of test steps. |
| 176 | 180 |
| 177 Args: | 181 Args: |
| 178 test_suite: The name of the test suite. | 182 test_suite: The name of the test suite. |
| 179 """ | 183 """ |
| 180 if self.c.use_isolate: | 184 context = {} |
| 181 self.m.isolate.remove_build_metadata() | 185 if self._working_dir: |
| 182 self.m.isolate.isolate_tests(self.m.chromium.output_dir, | 186 context['cwd'] = self._working_dir |
| 183 targets=self.NORMAL_TESTS) | |
| 184 | 187 |
| 185 tests = steps.generate_tests(self, self.c.TEST_SUITE, self.revision, | 188 with self.m.step.context(context): |
| 186 self.c.enable_swarming) | 189 if self.c.use_isolate: |
| 187 with self.m.step.defer_results(): | 190 self.m.isolate.remove_build_metadata() |
| 188 if tests: | 191 self.m.isolate.isolate_tests(self.m.chromium.output_dir, |
| 189 if self.m.chromium.c.TARGET_PLATFORM == 'android': | 192 targets=self.NORMAL_TESTS) |
| 190 self.m.chromium_android.common_tests_setup_steps() | |
| 191 | 193 |
| 194 tests = steps.generate_tests(self, self.c.TEST_SUITE, self.revision, |
| 195 self.c.enable_swarming) |
| 196 with self.m.step.defer_results(): |
| 197 if tests: |
| 198 if self.m.chromium.c.TARGET_PLATFORM == 'android': |
| 199 self.m.chromium_android.common_tests_setup_steps() |
| 200 |
| 201 for test in tests: |
| 202 test.run(self, suffix='') |
| 203 |
| 204 if self.m.chromium.c.TARGET_PLATFORM == 'android': |
| 205 self.m.chromium_android.shutdown_device_monitor() |
| 206 self.m.chromium_android.logcat_dump(gs_bucket='chromium-android') |
| 207 self.m.chromium_android.stack_tool_steps(force_latest_version=True) |
| 208 self.m.chromium_android.test_report() |
| 209 |
| 210 with self.m.step.defer_results(): |
| 192 for test in tests: | 211 for test in tests: |
| 193 test.run(self, suffix='') | 212 if test.enable_swarming: |
| 194 | 213 self.m.swarming.collect_task(test.swarming_task) |
| 195 if self.m.chromium.c.TARGET_PLATFORM == 'android': | |
| 196 self.m.chromium_android.shutdown_device_monitor() | |
| 197 self.m.chromium_android.logcat_dump(gs_bucket='chromium-android') | |
| 198 self.m.chromium_android.stack_tool_steps(force_latest_version=True) | |
| 199 self.m.chromium_android.test_report() | |
| 200 | |
| 201 with self.m.step.defer_results(): | |
| 202 for test in tests: | |
| 203 if test.enable_swarming: | |
| 204 self.m.swarming.collect_task(test.swarming_task) | |
| 205 | 214 |
| 206 | 215 |
| 207 def add_test(self, test, name=None, args=None, revision=None, env=None, | 216 def add_test(self, test, name=None, args=None, revision=None, env=None, |
| 208 python_mode=False, perf_test=False, perf_dashboard_id=None, | 217 python_mode=False, perf_test=False, perf_dashboard_id=None, |
| 209 parallel=True): | 218 parallel=True): |
| 210 """Helper function to invoke chromium.runtest(). | 219 """Helper function to invoke chromium.runtest(). |
| 211 | 220 |
| 212 Notice that the name parameter should be the same as the test executable in | 221 Notice that the name parameter should be the same as the test executable in |
| 213 order to get the stdio links in the perf dashboard to become correct. | 222 order to get the stdio links in the perf dashboard to become correct. |
| 214 """ | 223 """ |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 def clean_test_output(self): | 315 def clean_test_output(self): |
| 307 """Remove all test output in out/, since we have tests leaking files.""" | 316 """Remove all test output in out/, since we have tests leaking files.""" |
| 308 out_dir = self.m.path['checkout'].join('out') | 317 out_dir = self.m.path['checkout'].join('out') |
| 309 self.m.python('clean test output files', | 318 self.m.python('clean test output files', |
| 310 script=self.resource('cleanup_files.py'), | 319 script=self.resource('cleanup_files.py'), |
| 311 args=[out_dir], | 320 args=[out_dir], |
| 312 infra_step=True) | 321 infra_step=True) |
| 313 | 322 |
| 314 def virtual_webcam_check(self): | 323 def virtual_webcam_check(self): |
| 315 self.m.python('webcam_check', self.resource('ensure_webcam_is_running.py')) | 324 self.m.python('webcam_check', self.resource('ensure_webcam_is_running.py')) |
| OLD | NEW |