| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 import re | 5 import re |
| 6 import string | 6 import string |
| 7 | 7 |
| 8 | 8 |
| 9 class Test(object): | 9 class Test(object): |
| 10 """ | 10 """ |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 else: | 304 else: |
| 305 kwargs['xvfb'] = True | 305 kwargs['xvfb'] = True |
| 306 kwargs['test_type'] = self.name | 306 kwargs['test_type'] = self.name |
| 307 kwargs['annotate'] = 'gtest' | 307 kwargs['annotate'] = 'gtest' |
| 308 kwargs['test_launcher_summary_output'] = gtest_results_file | 308 kwargs['test_launcher_summary_output'] = gtest_results_file |
| 309 kwargs.update(self._runtest_kwargs) | 309 kwargs.update(self._runtest_kwargs) |
| 310 | 310 |
| 311 try: | 311 try: |
| 312 if is_android: | 312 if is_android: |
| 313 api.chromium_android.run_test_suite(self.target_name, **kwargs) | 313 api.chromium_android.run_test_suite(self.target_name, **kwargs) |
| 314 elif self._use_isolate: | |
| 315 api.isolate.runtest(self.target_name, self._revision, | |
| 316 self._webkit_revision, **kwargs) | |
| 317 else: | 314 else: |
| 318 api.chromium.runtest(self.target_name, revision=self._revision, | 315 api.chromium.runtest(self.target_name, revision=self._revision, |
| 319 webkit_revision=self._webkit_revision, **kwargs) | 316 webkit_revision=self._webkit_revision, **kwargs) |
| 317 # TODO(kbr): add functionality to generate_gtest to be able to |
| 318 # force running these local gtests via isolate from the src-side |
| 319 # JSON files. crbug.com/584469 |
| 320 finally: | 320 finally: |
| 321 step_result = api.step.active_result | 321 step_result = api.step.active_result |
| 322 self._test_runs[suffix] = step_result | 322 self._test_runs[suffix] = step_result |
| 323 | 323 |
| 324 if hasattr(step_result, 'test_utils'): | 324 if hasattr(step_result, 'test_utils'): |
| 325 r = step_result.test_utils.gtest_results | 325 r = step_result.test_utils.gtest_results |
| 326 p = step_result.presentation | 326 p = step_result.presentation |
| 327 | 327 |
| 328 if r.valid: | 328 if r.valid: |
| 329 p.step_text += api.test_utils.format_step_text([ | 329 p.step_text += api.test_utils.format_step_text([ |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 663 self._tasks[suffix].dimensions.pop(k, None) | 663 self._tasks[suffix].dimensions.pop(k, None) |
| 664 else: | 664 else: |
| 665 self._tasks[suffix].dimensions[k] = v | 665 self._tasks[suffix].dimensions[k] = v |
| 666 | 666 |
| 667 # Add config-specific tags. | 667 # Add config-specific tags. |
| 668 self._tasks[suffix].tags.update(api.chromium.c.runtests.swarming_tags) | 668 self._tasks[suffix].tags.update(api.chromium.c.runtests.swarming_tags) |
| 669 | 669 |
| 670 # Add custom tags. | 670 # Add custom tags. |
| 671 if self._tags: | 671 if self._tags: |
| 672 # TODO(kbr): figure out how to cover this line of code with | 672 # TODO(kbr): figure out how to cover this line of code with |
| 673 # tests after the removal of the GPU recipe. | 673 # tests after the removal of the GPU recipe. crbug.com/584469 |
| 674 self._tasks[suffix].tags.update(self._tags) # pragma: no cover | 674 self._tasks[suffix].tags.update(self._tags) # pragma: no cover |
| 675 | 675 |
| 676 # Set default value. | 676 # Set default value. |
| 677 if 'os' not in self._tasks[suffix].dimensions: | 677 if 'os' not in self._tasks[suffix].dimensions: |
| 678 self._tasks[suffix].dimensions['os'] = api.swarming.prefered_os_dimension( | 678 self._tasks[suffix].dimensions['os'] = api.swarming.prefered_os_dimension( |
| 679 api.platform.name) | 679 api.platform.name) |
| 680 | 680 |
| 681 return api.swarming.trigger_task(self._tasks[suffix]) | 681 return api.swarming.trigger_task(self._tasks[suffix]) |
| 682 | 682 |
| 683 def run(self, api, suffix, test_filter=None): # pylint: disable=R0201 | 683 def run(self, api, suffix, test_filter=None): # pylint: disable=R0201 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 try: | 720 try: |
| 721 api.swarming.collect_task(self._tasks[suffix]) | 721 api.swarming.collect_task(self._tasks[suffix]) |
| 722 finally: | 722 finally: |
| 723 valid, failures = self.validate_task_results(api, api.step.active_result) | 723 valid, failures = self.validate_task_results(api, api.step.active_result) |
| 724 self._results[suffix] = {'valid': valid, 'failures': failures} | 724 self._results[suffix] = {'valid': valid, 'failures': failures} |
| 725 | 725 |
| 726 def has_valid_results(self, api, suffix): | 726 def has_valid_results(self, api, suffix): |
| 727 # Test wasn't triggered or wasn't collected. | 727 # Test wasn't triggered or wasn't collected. |
| 728 if suffix not in self._tasks or not suffix in self._results: | 728 if suffix not in self._tasks or not suffix in self._results: |
| 729 # TODO(kbr): figure out how to cover this line of code with | 729 # TODO(kbr): figure out how to cover this line of code with |
| 730 # tests after the removal of the GPU recipe. | 730 # tests after the removal of the GPU recipe. crbug.com/584469 |
| 731 return False # pragma: no cover | 731 return False # pragma: no cover |
| 732 return self._results[suffix]['valid'] | 732 return self._results[suffix]['valid'] |
| 733 | 733 |
| 734 def failures(self, api, suffix): | 734 def failures(self, api, suffix): |
| 735 assert self.has_valid_results(api, suffix) | 735 assert self.has_valid_results(api, suffix) |
| 736 return self._results[suffix]['failures'] | 736 return self._results[suffix]['failures'] |
| 737 | 737 |
| 738 @property | 738 @property |
| 739 def uses_swarming(self): | 739 def uses_swarming(self): |
| 740 return True | 740 return True |
| (...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1278 return self._test.has_valid_results(api, suffix) | 1278 return self._test.has_valid_results(api, suffix) |
| 1279 | 1279 |
| 1280 def failures(self, api, suffix): | 1280 def failures(self, api, suffix): |
| 1281 return self._test.failures(api, suffix) | 1281 return self._test.failures(api, suffix) |
| 1282 | 1282 |
| 1283 @property | 1283 @property |
| 1284 def uses_swarming(self): | 1284 def uses_swarming(self): |
| 1285 return self._test.uses_swarming | 1285 return self._test.uses_swarming |
| 1286 | 1286 |
| 1287 | 1287 |
| 1288 # TODO(sergiyb): GPU Tests do not always follow the Chromium convention to have | |
| 1289 # a 'test' target for each 'test_run' target. Instead they use gyp dependencies. | |
| 1290 # Chromium tests return both 'test' and 'test_run' to circumvent and issue with | |
| 1291 # analyze step, while GPU tests do not require this. | |
| 1292 class GPUGTestTest(GTestTest): | |
| 1293 def __init__(self, name, **kwargs): | |
| 1294 kwargs['swarming_tags'] = set(kwargs.get('swarming_tags') or []) | |
| 1295 kwargs['swarming_tags'] |= {'gpu_test:1'} | |
| 1296 super(GPUGTestTest, self).__init__(name, **kwargs) | |
| 1297 | |
| 1298 def compile_targets(self, api): | |
| 1299 return ['%s_run' % self._test.target_name] # pragma: no cover | |
| 1300 | |
| 1301 | |
| 1302 class PythonBasedTest(Test): | 1288 class PythonBasedTest(Test): |
| 1303 @staticmethod | 1289 @staticmethod |
| 1304 def compile_targets(_): | 1290 def compile_targets(_): |
| 1305 return [] # pragma: no cover | 1291 return [] # pragma: no cover |
| 1306 | 1292 |
| 1307 def run_step(self, api, suffix, cmd_args, **kwargs): | 1293 def run_step(self, api, suffix, cmd_args, **kwargs): |
| 1308 raise NotImplementedError() # pragma: no cover | 1294 raise NotImplementedError() # pragma: no cover |
| 1309 | 1295 |
| 1310 def run(self, api, suffix, test_filter=None): | 1296 def run(self, api, suffix, test_filter=None): |
| 1311 cmd_args = ['--write-full-results-to', | 1297 cmd_args = ['--write-full-results-to', |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1809 def run(self, api, suffix, test_filter=None): | 1795 def run(self, api, suffix, test_filter=None): |
| 1810 api.chromium_android.coverage_report(upload=False) | 1796 api.chromium_android.coverage_report(upload=False) |
| 1811 api.chromium_android.get_changed_lines_for_revision() | 1797 api.chromium_android.get_changed_lines_for_revision() |
| 1812 api.chromium_android.incremental_coverage_report() | 1798 api.chromium_android.incremental_coverage_report() |
| 1813 | 1799 |
| 1814 | 1800 |
| 1815 GOMA_TESTS = [ | 1801 GOMA_TESTS = [ |
| 1816 GTestTest('base_unittests'), | 1802 GTestTest('base_unittests'), |
| 1817 GTestTest('content_unittests'), | 1803 GTestTest('content_unittests'), |
| 1818 ] | 1804 ] |
| OLD | NEW |